netsurf: branch master updated. release/3.0-573-g308a24e
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/308a24e66171190d321df...
...commit http://git.netsurf-browser.org/netsurf.git/commit/308a24e66171190d321dfed...
...tree http://git.netsurf-browser.org/netsurf.git/tree/308a24e66171190d321dfed62...
The branch, master has been updated
via 308a24e66171190d321dfed622dc83e16bd64549 (commit)
via 97aceb5a681faf288e38b5db9e408931ff0d3e6b (commit)
via 10b422b16344f24bbb766f52dc3f0d6da7fde194 (commit)
from 704e5cc839b5baa02fba5e1ceba3d37aa2f37bb8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=308a24e66171190d321...
commit 308a24e66171190d321dfed622dc83e16bd64549
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Start implementing undo/redo. For now it just records changes, the actual undo/redo handling is not yet done.
diff --git a/desktop/textarea.c b/desktop/textarea.c
index 65f0c53..8f53bf7 100644
--- a/desktop/textarea.c
+++ b/desktop/textarea.c
@@ -64,13 +64,19 @@ struct textarea_utf8 {
};
struct textarea_undo_detail {
- unsigned int offset; /**< Offset to detail's text in undo.text */
- unsigned int len; /**< Length of detail's text */
+ unsigned int b_start; /**< Offset to detail's text in undo buffer */
+ unsigned int b_end; /**< End of text (exclusive) */
+ unsigned int b_limit; /**< End of detail space (exclusive) */
+
+ unsigned int b_text_start; /**< Start of textarea text. */
+ unsigned int b_text_end; /**< End of textarea text (exclusive) */
};
struct textarea_undo {
- unsigned int next_detail;
- struct textarea_undo_detail *details;
+ unsigned int details_alloc; /**< Details allocated for */
+ unsigned int next_detail; /**< Next detail pos */
+ unsigned int last_detail; /**< Last detail used */
+ struct textarea_undo_detail *details; /**< Array of undo details */
struct textarea_utf8 text;
};
@@ -135,6 +141,8 @@ struct textarea {
int drag_start; /**< Byte offset of drag start (in ta->show) */
struct textarea_drag drag_info; /**< Drag information */
+
+ struct textarea_undo undo; /**< Undo/redo information */
};
@@ -1425,7 +1433,7 @@ static bool textarea_replace_text_internal(struct textarea *ta, size_t b_start,
/* Ensure textarea's text buffer is large enough */
if (rep_len + ta->text.len - (b_end - b_start) >= ta->text.alloc) {
char *temp = realloc(ta->text.data,
- rep_len + ta->text.len - (b_end - b_start) +
+ rep_len + ta->text.len - (b_end - b_start) +
TA_ALLOC_STEP);
if (temp == NULL) {
LOG(("realloc failed"));
@@ -1474,6 +1482,74 @@ static bool textarea_replace_text_internal(struct textarea *ta, size_t b_start,
/**
+ * Update undo buffer by adding any text to be replaced, and allocating
+ * space as appropriate.
+ *
+ * \param ta Textarea widget
+ * \param b_start Start byte index of replaced section (inclusive)
+ * \param b_end End byte index of replaced section (exclusive)
+ * \param rep_len Byte length of replacement UTF-8 text
+ * \return false on memory exhaustion, true otherwise
+ */
+static bool textarea_copy_to_undo_buffer(struct textarea *ta,
+ size_t b_start, size_t b_end, size_t rep_len)
+{
+ struct textarea_undo *undo;
+ size_t b_offset;
+ unsigned int len = b_end - b_start;
+
+ undo = &ta->undo;
+
+ if (undo->next_detail == 0)
+ b_offset = 0;
+ else
+ b_offset = undo->details[undo->next_detail - 1].b_limit;
+
+ len = len > rep_len ? len : rep_len;
+
+ if (b_offset + len >= undo->text.alloc) {
+ /* Need more memory for undo buffer */
+ char *temp = realloc(undo->text.data,
+ b_offset + len + TA_ALLOC_STEP);
+ if (temp == NULL) {
+ LOG(("realloc failed"));
+ return false;
+ }
+
+ undo->text.data = temp;
+ undo->text.alloc = b_offset + len + TA_ALLOC_STEP;
+ }
+
+ if (undo->next_detail >= undo->details_alloc) {
+ /* Need more memory for undo details */
+ struct textarea_undo_detail *temp = realloc(undo->details,
+ (undo->next_detail + 128) *
+ sizeof(struct textarea_undo_detail));
+ if (temp == NULL) {
+ LOG(("realloc failed"));
+ return false;
+ }
+
+ undo->details = temp;
+ undo->details_alloc = undo->next_detail + 128;
+ }
+
+ /* Put text into buffer */
+ memcpy(undo->text.data + b_offset, ta->text.data + b_start,
+ b_end - b_start);
+
+ /* Update next_detail */
+ undo->details[undo->next_detail].b_start = b_offset;
+ undo->details[undo->next_detail].b_end = b_offset + b_end - b_start;
+ undo->details[undo->next_detail].b_limit = len;
+
+ undo->details[undo->next_detail].b_text_start = b_start;
+
+ return true;
+}
+
+
+/**
* Replace text in a textarea, updating undo buffer.
*
* \param ta Textarea widget
@@ -1493,8 +1569,13 @@ static bool textarea_replace_text(struct textarea *ta, size_t b_start,
size_t b_end, const char *rep, size_t rep_len,
bool add_to_clipboard, int *byte_delta, struct rect *r)
{
- /* TODO: Make copy of any replaced text */
- if (b_start != b_end) {
+ if (!(b_start != b_end && rep_len == 0 && add_to_clipboard) &&
+ !(ta->flags & TEXTAREA_PASSWORD)) {
+ /* Not just copying to clipboard, and not a password field;
+ * Sort out undo buffer. */
+ if (textarea_copy_to_undo_buffer(ta, b_start, b_end,
+ rep_len) == false)
+ return false;
}
/* Replace the text in the textarea, and reflow it */
@@ -1503,12 +1584,63 @@ static bool textarea_replace_text(struct textarea *ta, size_t b_start,
return false;
}
- if (b_start == b_end && rep_len == 0) {
- /* Nothing changed at all */
- return true;
+ if (!(b_start != b_end && rep_len == 0 && add_to_clipboard) &&
+ !(ta->flags & TEXTAREA_PASSWORD)) {
+ /* Not just copying to clipboard, and not a password field;
+ * Update UNDO buffer */
+ ta->undo.details[ta->undo.next_detail].b_text_end =
+ b_end + *byte_delta;
+ ta->undo.last_detail = ta->undo.next_detail;
+ ta->undo.next_detail++;
}
- /* TODO: Update UNDO buffer */
+ return true;
+}
+
+
+/**
+ * Undo previous change.
+ *
+ * \param ta Textarea widget
+ * \param byte_delta Updated to change in byte count in textarea (ta->show)
+ * \param r Updated to area where redraw is required
+ * \return false if nothing to undo, true otherwise
+ */
+static bool textarea_undo(struct textarea *ta, int *byte_delta, struct rect *r)
+{
+ if (ta->flags & TEXTAREA_PASSWORD)
+ /* No undo for password fields */
+ return false;
+
+ if (ta->undo.next_detail == 0)
+ /* Nothing to undo */
+ return false;
+
+ /* TODO */
+
+ return true;
+}
+
+
+/**
+ * Redo previous undo.
+ *
+ * \param ta Textarea widget
+ * \param byte_delta Updated to change in byte count in textarea (ta->show)
+ * \param r Updated to area where redraw is required
+ * \return false if nothing to redo, true otherwise
+ */
+static bool textarea_redo(struct textarea *ta, int *byte_delta, struct rect *r)
+{
+ if (ta->flags & TEXTAREA_PASSWORD)
+ /* No REDO for password fields */
+ return false;
+
+ if (ta->undo.next_detail > ta->undo.last_detail)
+ /* Nothing to redo */
+ return false;
+
+ /* TODO */
return true;
}
@@ -1652,9 +1784,21 @@ struct textarea *textarea_create(const textarea_flags flags,
ret->scroll_y = 0;
ret->bar_x = NULL;
ret->bar_y = NULL;
+ ret->h_extent = setup->width;
+ ret->v_extent = setup->height;
ret->drag_start = 0;
ret->drag_info.type = TEXTAREA_DRAG_NONE;
+ ret->undo.details_alloc = 0;
+ ret->undo.next_detail = 0;
+ ret->undo.last_detail = 0;
+ ret->undo.details = NULL;
+
+ ret->undo.text.data = NULL;
+ ret->undo.text.alloc = 0;
+ ret->undo.text.len = 0;
+ ret->undo.text.utf8_len = 0;
+
ret->text.data = malloc(TA_ALLOC_STEP);
if (ret->text.data == NULL) {
@@ -1727,6 +1871,9 @@ void textarea_destroy(struct textarea *ta)
if (ta->flags & TEXTAREA_PASSWORD)
free(ta->password.data);
+ free(ta->undo.text.data);
+ free(ta->undo.details);
+
free(ta->text.data);
free(ta->lines);
free(ta);
@@ -2562,6 +2709,30 @@ bool textarea_keypress(struct textarea *ta, uint32_t key)
}
caret += byte_delta;
break;
+ case KEY_UNDO:
+ if (!textarea_undo(ta, &byte_delta, &r)) {
+ /* We consume the UNDO, even if we can't act
+ * on it. */
+ return true;
+ }
+ caret += byte_delta;
+ if (ta->sel_start != -1) {
+ textarea_clear_selection(ta);
+ }
+ redraw = true;
+ break;
+ case KEY_REDO:
+ if (!textarea_redo(ta, &byte_delta, &r)) {
+ /* We consume the REDO, even if we can't act
+ * on it. */
+ return true;
+ }
+ caret += byte_delta;
+ if (ta->sel_start != -1) {
+ textarea_clear_selection(ta);
+ }
+ redraw = true;
+ break;
default:
return false;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=97aceb5a681faf288e3...
commit 97aceb5a681faf288e38b5db9e408931ff0d3e6b
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Pass KEY_UNDO and KEY_REDO to core. (Currently ignored.)
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index c9adf6c..6530c38 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -971,6 +971,34 @@ fb_browser_window_input(fbtk_widget_t *widget, fbtk_callback_info *cbi)
modifier |= FBTK_MOD_LCTRL;
break;
+ case NSFB_KEY_y:
+ case NSFB_KEY_z:
+ if (cbi->event->value.keycode == NSFB_KEY_z &&
+ (modifier & FBTK_MOD_RCTRL ||
+ modifier & FBTK_MOD_LCTRL) &&
+ (modifier & FBTK_MOD_RSHIFT ||
+ modifier & FBTK_MOD_LSHIFT)) {
+ /* Z pressed with CTRL and SHIFT held */
+ browser_window_key_press(gw->bw, KEY_REDO);
+ break;
+
+ } else if (cbi->event->value.keycode == NSFB_KEY_z &&
+ (modifier & FBTK_MOD_RCTRL ||
+ modifier & FBTK_MOD_LCTRL)) {
+ /* Z pressed with CTRL held */
+ browser_window_key_press(gw->bw, KEY_UNDO);
+ break;
+
+ } else if (cbi->event->value.keycode == NSFB_KEY_y &&
+ (modifier & FBTK_MOD_RCTRL ||
+ modifier & FBTK_MOD_LCTRL)) {
+ /* Y pressed with CTRL held */
+ browser_window_key_press(gw->bw, KEY_REDO);
+ break;
+ }
+ /* Z or Y pressed but not undo or redo;
+ * Fall through to default handling */
+
default:
ucs4 = fbtk_keycode_to_ucs4(cbi->event->value.keycode,
modifier);
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=10b422b16344f24bbb7...
commit 10b422b16344f24bbb766f52dc3f0d6da7fde194
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Pass KEY_UNDO and KEY_REDO to core. (Currently ignored.)
diff --git a/gtk/gui.c b/gtk/gui.c
index 226d718..d7598c3 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -1089,6 +1089,17 @@ uint32_t gtk_gui_gdkkey_to_nskey(GdkEventKey *key)
if (key->state & GDK_CONTROL_MASK)
return KEY_CUT_SELECTION;
return gdk_keyval_to_unicode(key->keyval);
+ case 'y':
+ if (key->state & GDK_CONTROL_MASK)
+ return KEY_REDO;
+ return gdk_keyval_to_unicode(key->keyval);
+ case 'z':
+ if (key->state & GDK_CONTROL_MASK &&
+ key->state & GDK_SHIFT_MASK)
+ return KEY_REDO;
+ if (key->state & GDK_CONTROL_MASK)
+ return KEY_UNDO;
+ return gdk_keyval_to_unicode(key->keyval);
case GDK_KEY(Escape):
return KEY_ESCAPE;
-----------------------------------------------------------------------
Summary of changes:
desktop/textarea.c | 193 +++++++++++++++++++++++++++++++++++++++++++++++++---
framebuffer/gui.c | 28 ++++++++
gtk/gui.c | 11 +++
3 files changed, 221 insertions(+), 11 deletions(-)
diff --git a/desktop/textarea.c b/desktop/textarea.c
index 65f0c53..8f53bf7 100644
--- a/desktop/textarea.c
+++ b/desktop/textarea.c
@@ -64,13 +64,19 @@ struct textarea_utf8 {
};
struct textarea_undo_detail {
- unsigned int offset; /**< Offset to detail's text in undo.text */
- unsigned int len; /**< Length of detail's text */
+ unsigned int b_start; /**< Offset to detail's text in undo buffer */
+ unsigned int b_end; /**< End of text (exclusive) */
+ unsigned int b_limit; /**< End of detail space (exclusive) */
+
+ unsigned int b_text_start; /**< Start of textarea text. */
+ unsigned int b_text_end; /**< End of textarea text (exclusive) */
};
struct textarea_undo {
- unsigned int next_detail;
- struct textarea_undo_detail *details;
+ unsigned int details_alloc; /**< Details allocated for */
+ unsigned int next_detail; /**< Next detail pos */
+ unsigned int last_detail; /**< Last detail used */
+ struct textarea_undo_detail *details; /**< Array of undo details */
struct textarea_utf8 text;
};
@@ -135,6 +141,8 @@ struct textarea {
int drag_start; /**< Byte offset of drag start (in ta->show) */
struct textarea_drag drag_info; /**< Drag information */
+
+ struct textarea_undo undo; /**< Undo/redo information */
};
@@ -1425,7 +1433,7 @@ static bool textarea_replace_text_internal(struct textarea *ta, size_t b_start,
/* Ensure textarea's text buffer is large enough */
if (rep_len + ta->text.len - (b_end - b_start) >= ta->text.alloc) {
char *temp = realloc(ta->text.data,
- rep_len + ta->text.len - (b_end - b_start) +
+ rep_len + ta->text.len - (b_end - b_start) +
TA_ALLOC_STEP);
if (temp == NULL) {
LOG(("realloc failed"));
@@ -1474,6 +1482,74 @@ static bool textarea_replace_text_internal(struct textarea *ta, size_t b_start,
/**
+ * Update undo buffer by adding any text to be replaced, and allocating
+ * space as appropriate.
+ *
+ * \param ta Textarea widget
+ * \param b_start Start byte index of replaced section (inclusive)
+ * \param b_end End byte index of replaced section (exclusive)
+ * \param rep_len Byte length of replacement UTF-8 text
+ * \return false on memory exhaustion, true otherwise
+ */
+static bool textarea_copy_to_undo_buffer(struct textarea *ta,
+ size_t b_start, size_t b_end, size_t rep_len)
+{
+ struct textarea_undo *undo;
+ size_t b_offset;
+ unsigned int len = b_end - b_start;
+
+ undo = &ta->undo;
+
+ if (undo->next_detail == 0)
+ b_offset = 0;
+ else
+ b_offset = undo->details[undo->next_detail - 1].b_limit;
+
+ len = len > rep_len ? len : rep_len;
+
+ if (b_offset + len >= undo->text.alloc) {
+ /* Need more memory for undo buffer */
+ char *temp = realloc(undo->text.data,
+ b_offset + len + TA_ALLOC_STEP);
+ if (temp == NULL) {
+ LOG(("realloc failed"));
+ return false;
+ }
+
+ undo->text.data = temp;
+ undo->text.alloc = b_offset + len + TA_ALLOC_STEP;
+ }
+
+ if (undo->next_detail >= undo->details_alloc) {
+ /* Need more memory for undo details */
+ struct textarea_undo_detail *temp = realloc(undo->details,
+ (undo->next_detail + 128) *
+ sizeof(struct textarea_undo_detail));
+ if (temp == NULL) {
+ LOG(("realloc failed"));
+ return false;
+ }
+
+ undo->details = temp;
+ undo->details_alloc = undo->next_detail + 128;
+ }
+
+ /* Put text into buffer */
+ memcpy(undo->text.data + b_offset, ta->text.data + b_start,
+ b_end - b_start);
+
+ /* Update next_detail */
+ undo->details[undo->next_detail].b_start = b_offset;
+ undo->details[undo->next_detail].b_end = b_offset + b_end - b_start;
+ undo->details[undo->next_detail].b_limit = len;
+
+ undo->details[undo->next_detail].b_text_start = b_start;
+
+ return true;
+}
+
+
+/**
* Replace text in a textarea, updating undo buffer.
*
* \param ta Textarea widget
@@ -1493,8 +1569,13 @@ static bool textarea_replace_text(struct textarea *ta, size_t b_start,
size_t b_end, const char *rep, size_t rep_len,
bool add_to_clipboard, int *byte_delta, struct rect *r)
{
- /* TODO: Make copy of any replaced text */
- if (b_start != b_end) {
+ if (!(b_start != b_end && rep_len == 0 && add_to_clipboard) &&
+ !(ta->flags & TEXTAREA_PASSWORD)) {
+ /* Not just copying to clipboard, and not a password field;
+ * Sort out undo buffer. */
+ if (textarea_copy_to_undo_buffer(ta, b_start, b_end,
+ rep_len) == false)
+ return false;
}
/* Replace the text in the textarea, and reflow it */
@@ -1503,12 +1584,63 @@ static bool textarea_replace_text(struct textarea *ta, size_t b_start,
return false;
}
- if (b_start == b_end && rep_len == 0) {
- /* Nothing changed at all */
- return true;
+ if (!(b_start != b_end && rep_len == 0 && add_to_clipboard) &&
+ !(ta->flags & TEXTAREA_PASSWORD)) {
+ /* Not just copying to clipboard, and not a password field;
+ * Update UNDO buffer */
+ ta->undo.details[ta->undo.next_detail].b_text_end =
+ b_end + *byte_delta;
+ ta->undo.last_detail = ta->undo.next_detail;
+ ta->undo.next_detail++;
}
- /* TODO: Update UNDO buffer */
+ return true;
+}
+
+
+/**
+ * Undo previous change.
+ *
+ * \param ta Textarea widget
+ * \param byte_delta Updated to change in byte count in textarea (ta->show)
+ * \param r Updated to area where redraw is required
+ * \return false if nothing to undo, true otherwise
+ */
+static bool textarea_undo(struct textarea *ta, int *byte_delta, struct rect *r)
+{
+ if (ta->flags & TEXTAREA_PASSWORD)
+ /* No undo for password fields */
+ return false;
+
+ if (ta->undo.next_detail == 0)
+ /* Nothing to undo */
+ return false;
+
+ /* TODO */
+
+ return true;
+}
+
+
+/**
+ * Redo previous undo.
+ *
+ * \param ta Textarea widget
+ * \param byte_delta Updated to change in byte count in textarea (ta->show)
+ * \param r Updated to area where redraw is required
+ * \return false if nothing to redo, true otherwise
+ */
+static bool textarea_redo(struct textarea *ta, int *byte_delta, struct rect *r)
+{
+ if (ta->flags & TEXTAREA_PASSWORD)
+ /* No REDO for password fields */
+ return false;
+
+ if (ta->undo.next_detail > ta->undo.last_detail)
+ /* Nothing to redo */
+ return false;
+
+ /* TODO */
return true;
}
@@ -1652,9 +1784,21 @@ struct textarea *textarea_create(const textarea_flags flags,
ret->scroll_y = 0;
ret->bar_x = NULL;
ret->bar_y = NULL;
+ ret->h_extent = setup->width;
+ ret->v_extent = setup->height;
ret->drag_start = 0;
ret->drag_info.type = TEXTAREA_DRAG_NONE;
+ ret->undo.details_alloc = 0;
+ ret->undo.next_detail = 0;
+ ret->undo.last_detail = 0;
+ ret->undo.details = NULL;
+
+ ret->undo.text.data = NULL;
+ ret->undo.text.alloc = 0;
+ ret->undo.text.len = 0;
+ ret->undo.text.utf8_len = 0;
+
ret->text.data = malloc(TA_ALLOC_STEP);
if (ret->text.data == NULL) {
@@ -1727,6 +1871,9 @@ void textarea_destroy(struct textarea *ta)
if (ta->flags & TEXTAREA_PASSWORD)
free(ta->password.data);
+ free(ta->undo.text.data);
+ free(ta->undo.details);
+
free(ta->text.data);
free(ta->lines);
free(ta);
@@ -2562,6 +2709,30 @@ bool textarea_keypress(struct textarea *ta, uint32_t key)
}
caret += byte_delta;
break;
+ case KEY_UNDO:
+ if (!textarea_undo(ta, &byte_delta, &r)) {
+ /* We consume the UNDO, even if we can't act
+ * on it. */
+ return true;
+ }
+ caret += byte_delta;
+ if (ta->sel_start != -1) {
+ textarea_clear_selection(ta);
+ }
+ redraw = true;
+ break;
+ case KEY_REDO:
+ if (!textarea_redo(ta, &byte_delta, &r)) {
+ /* We consume the REDO, even if we can't act
+ * on it. */
+ return true;
+ }
+ caret += byte_delta;
+ if (ta->sel_start != -1) {
+ textarea_clear_selection(ta);
+ }
+ redraw = true;
+ break;
default:
return false;
}
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index c9adf6c..6530c38 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -971,6 +971,34 @@ fb_browser_window_input(fbtk_widget_t *widget, fbtk_callback_info *cbi)
modifier |= FBTK_MOD_LCTRL;
break;
+ case NSFB_KEY_y:
+ case NSFB_KEY_z:
+ if (cbi->event->value.keycode == NSFB_KEY_z &&
+ (modifier & FBTK_MOD_RCTRL ||
+ modifier & FBTK_MOD_LCTRL) &&
+ (modifier & FBTK_MOD_RSHIFT ||
+ modifier & FBTK_MOD_LSHIFT)) {
+ /* Z pressed with CTRL and SHIFT held */
+ browser_window_key_press(gw->bw, KEY_REDO);
+ break;
+
+ } else if (cbi->event->value.keycode == NSFB_KEY_z &&
+ (modifier & FBTK_MOD_RCTRL ||
+ modifier & FBTK_MOD_LCTRL)) {
+ /* Z pressed with CTRL held */
+ browser_window_key_press(gw->bw, KEY_UNDO);
+ break;
+
+ } else if (cbi->event->value.keycode == NSFB_KEY_y &&
+ (modifier & FBTK_MOD_RCTRL ||
+ modifier & FBTK_MOD_LCTRL)) {
+ /* Y pressed with CTRL held */
+ browser_window_key_press(gw->bw, KEY_REDO);
+ break;
+ }
+ /* Z or Y pressed but not undo or redo;
+ * Fall through to default handling */
+
default:
ucs4 = fbtk_keycode_to_ucs4(cbi->event->value.keycode,
modifier);
diff --git a/gtk/gui.c b/gtk/gui.c
index 226d718..d7598c3 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -1089,6 +1089,17 @@ uint32_t gtk_gui_gdkkey_to_nskey(GdkEventKey *key)
if (key->state & GDK_CONTROL_MASK)
return KEY_CUT_SELECTION;
return gdk_keyval_to_unicode(key->keyval);
+ case 'y':
+ if (key->state & GDK_CONTROL_MASK)
+ return KEY_REDO;
+ return gdk_keyval_to_unicode(key->keyval);
+ case 'z':
+ if (key->state & GDK_CONTROL_MASK &&
+ key->state & GDK_SHIFT_MASK)
+ return KEY_REDO;
+ if (key->state & GDK_CONTROL_MASK)
+ return KEY_UNDO;
+ return gdk_keyval_to_unicode(key->keyval);
case GDK_KEY(Escape):
return KEY_ESCAPE;
--
NetSurf Browser
9 years, 11 months
netsurf: branch master updated. release/3.0-570-g704e5cc
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/704e5cc839b5baa02fba5...
...commit http://git.netsurf-browser.org/netsurf.git/commit/704e5cc839b5baa02fba5e1...
...tree http://git.netsurf-browser.org/netsurf.git/tree/704e5cc839b5baa02fba5e1ce...
The branch, master has been updated
via 704e5cc839b5baa02fba5e1ceba3d37aa2f37bb8 (commit)
from bd85c009d3359f85ed5dd8211d797707b29af9cb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=704e5cc839b5baa02fb...
commit 704e5cc839b5baa02fba5e1ceba3d37aa2f37bb8
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Use a for loop instead
diff --git a/amiga/menu.c b/amiga/menu.c
index 9d47cbd..de4d63e 100644
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -318,7 +318,8 @@ void ami_menu_refresh(struct gui_window_2 *gwin)
static void ami_menu_load_glyphs(struct DrawInfo *dri)
{
- while(i < NSA_GLYPH_MAX) menu_glyph[i] = NULL;
+ for(int i = 0; i < NSA_GLYPH_MAX; i++)
+ menu_glyph[i] = NULL;
menu_glyph[NSA_GLYPH_SUBMENU] = NewObject(NULL, "sysiclass",
SYSIA_Which, MENUSUB,
@@ -341,7 +342,7 @@ void ami_menu_free_glyphs(void)
int i;
if(menu_glyphs_loaded == false) return;
- while(i < NSA_GLYPH_MAX) {
+ for(i = 0; i < NSA_GLYPH_MAX; i++) {
if(menu_glyph[i]) DisposeObject(menu_glyph[i]);
menu_glyph[i] = NULL;
};
-----------------------------------------------------------------------
Summary of changes:
amiga/menu.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/amiga/menu.c b/amiga/menu.c
index 9d47cbd..de4d63e 100644
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -318,7 +318,8 @@ void ami_menu_refresh(struct gui_window_2 *gwin)
static void ami_menu_load_glyphs(struct DrawInfo *dri)
{
- while(i < NSA_GLYPH_MAX) menu_glyph[i] = NULL;
+ for(int i = 0; i < NSA_GLYPH_MAX; i++)
+ menu_glyph[i] = NULL;
menu_glyph[NSA_GLYPH_SUBMENU] = NewObject(NULL, "sysiclass",
SYSIA_Which, MENUSUB,
@@ -341,7 +342,7 @@ void ami_menu_free_glyphs(void)
int i;
if(menu_glyphs_loaded == false) return;
- while(i < NSA_GLYPH_MAX) {
+ for(i = 0; i < NSA_GLYPH_MAX; i++) {
if(menu_glyph[i]) DisposeObject(menu_glyph[i]);
menu_glyph[i] = NULL;
};
--
NetSurf Browser
9 years, 11 months
netsurf: branch master updated. release/3.0-569-gbd85c00
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/bd85c009d3359f85ed5dd...
...commit http://git.netsurf-browser.org/netsurf.git/commit/bd85c009d3359f85ed5dd82...
...tree http://git.netsurf-browser.org/netsurf.git/tree/bd85c009d3359f85ed5dd8211...
The branch, master has been updated
via bd85c009d3359f85ed5dd8211d797707b29af9cb (commit)
from 87da43d373466f529ce6c79a50ef06a8c42004a7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=bd85c009d3359f85ed5...
commit bd85c009d3359f85ed5dd8211d797707b29af9cb
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Ensure the glyph array is NULLed before use, and that we don't attempt to free NULL entries.
diff --git a/amiga/menu.c b/amiga/menu.c
index e75e037..9d47cbd 100644
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -318,6 +318,8 @@ void ami_menu_refresh(struct gui_window_2 *gwin)
static void ami_menu_load_glyphs(struct DrawInfo *dri)
{
+ while(i < NSA_GLYPH_MAX) menu_glyph[i] = NULL;
+
menu_glyph[NSA_GLYPH_SUBMENU] = NewObject(NULL, "sysiclass",
SYSIA_Which, MENUSUB,
SYSIA_DrawInfo, dri,
@@ -340,7 +342,7 @@ void ami_menu_free_glyphs(void)
if(menu_glyphs_loaded == false) return;
while(i < NSA_GLYPH_MAX) {
- DisposeObject(menu_glyph[i]);
+ if(menu_glyph[i]) DisposeObject(menu_glyph[i]);
menu_glyph[i] = NULL;
};
-----------------------------------------------------------------------
Summary of changes:
amiga/menu.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/amiga/menu.c b/amiga/menu.c
index e75e037..9d47cbd 100644
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -318,6 +318,8 @@ void ami_menu_refresh(struct gui_window_2 *gwin)
static void ami_menu_load_glyphs(struct DrawInfo *dri)
{
+ while(i < NSA_GLYPH_MAX) menu_glyph[i] = NULL;
+
menu_glyph[NSA_GLYPH_SUBMENU] = NewObject(NULL, "sysiclass",
SYSIA_Which, MENUSUB,
SYSIA_DrawInfo, dri,
@@ -340,7 +342,7 @@ void ami_menu_free_glyphs(void)
if(menu_glyphs_loaded == false) return;
while(i < NSA_GLYPH_MAX) {
- DisposeObject(menu_glyph[i]);
+ if(menu_glyph[i]) DisposeObject(menu_glyph[i]);
menu_glyph[i] = NULL;
};
--
NetSurf Browser
9 years, 11 months
netsurf: branch master updated. release/3.0-568-g87da43d
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/87da43d373466f529ce6c...
...commit http://git.netsurf-browser.org/netsurf.git/commit/87da43d373466f529ce6c79...
...tree http://git.netsurf-browser.org/netsurf.git/tree/87da43d373466f529ce6c79a5...
The branch, master has been updated
via 87da43d373466f529ce6c79a50ef06a8c42004a7 (commit)
from fda18c49779f8abcd83eb902e1064147b1c397fc (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=87da43d373466f529ce...
commit 87da43d373466f529ce6c79a50ef06a8c42004a7
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Extra logging
diff --git a/amiga/gui.c b/amiga/gui.c
index 6b18ccd..b7c5585 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -2761,14 +2761,20 @@ void gui_quit(void)
ami_free_layers(&browserglob);
ami_close_fonts();
+
+ LOG(("Closing screen"));
ami_gui_close_screen(scrn, locked_screen);
FreeVec(nsscreentitle);
+ LOG(("Freeing menu items"));
ami_context_menu_free();
ami_menu_free_glyphs();
+ LOG(("Freeing mouse pointers"));
ami_mouse_pointers_free();
+ LOG(("Freeing clipboard"));
ami_clipboard_free();
+
ami_print_free();
FreeSysObject(ASOT_PORT,appport);
@@ -2786,6 +2792,7 @@ void gui_quit(void)
if(IKeymap) DropInterface((struct Interface *)IKeymap);
if(KeymapBase) CloseLibrary(KeymapBase);
+ LOG(("Freeing scheduler"));
ami_schedule_free();
ami_schedule_close_timer();
-----------------------------------------------------------------------
Summary of changes:
amiga/gui.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/amiga/gui.c b/amiga/gui.c
index 6b18ccd..b7c5585 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -2761,14 +2761,20 @@ void gui_quit(void)
ami_free_layers(&browserglob);
ami_close_fonts();
+
+ LOG(("Closing screen"));
ami_gui_close_screen(scrn, locked_screen);
FreeVec(nsscreentitle);
+ LOG(("Freeing menu items"));
ami_context_menu_free();
ami_menu_free_glyphs();
+ LOG(("Freeing mouse pointers"));
ami_mouse_pointers_free();
+ LOG(("Freeing clipboard"));
ami_clipboard_free();
+
ami_print_free();
FreeSysObject(ASOT_PORT,appport);
@@ -2786,6 +2792,7 @@ void gui_quit(void)
if(IKeymap) DropInterface((struct Interface *)IKeymap);
if(KeymapBase) CloseLibrary(KeymapBase);
+ LOG(("Freeing scheduler"));
ami_schedule_free();
ami_schedule_close_timer();
--
NetSurf Browser
9 years, 11 months
netsurf: branch mono/atari_treeview_rework updated. release/3.0-580-g10e3ad3
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/10e3ad358248595ca1289...
...commit http://git.netsurf-browser.org/netsurf.git/commit/10e3ad358248595ca1289ee...
...tree http://git.netsurf-browser.org/netsurf.git/tree/10e3ad358248595ca1289eeff...
The branch, mono/atari_treeview_rework has been updated
via 10e3ad358248595ca1289eeff597351c283f6b45 (commit)
from dacd02e955d398e2556ae7f70de37b611d383c24 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=10e3ad358248595ca12...
commit 10e3ad358248595ca1289eeff597351c283f6b45
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Added about dialog, fixed scrolled treeview redraw.
diff --git a/atari/Makefile.target b/atari/Makefile.target
index a8bc65a..b2530cf 100644
--- a/atari/Makefile.target
+++ b/atari/Makefile.target
@@ -75,6 +75,7 @@ LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib
# S_ATARI are sources purely for the Atari FreeMiNT build
S_ATARI := \
+ about.c \
bitmap.c \
clipboard.c \
ctxmenu.c \
diff --git a/atari/about.c b/atari/about.c
new file mode 100644
index 0000000..f09dfb3
--- /dev/null
+++ b/atari/about.c
@@ -0,0 +1,208 @@
+/*
+ * Copyright 2013 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <limits.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "cflib.h"
+#include "atari/misc.h"
+#include "atari/plot/plot.h"
+#include "atari/gemtk/gemtk.h"
+#include "atari/res/netsurf.rsh"
+#include "atari/about.h"
+
+#include "utils/testament.h"
+#include "utils/useragent.h"
+#include "desktop/netsurf.h"
+#include "utils/nsurl.h"
+#include "utils/messages.h"
+
+
+#include "curl/curlver.h"
+
+
+static OBJECT * about_form = NULL;
+static char * infocontent;
+static char version[32];
+VdiHdl vdihandle;
+
+
+static short __CDECL about_userdraw(PARMBLK *parmblock)
+{
+ short pxy[8];
+ short dummy;
+ int content_len;
+ char *content;
+ short cur_x, cur_y;
+ short cheight = 8, cwidth = gl_wchar;
+ char c[2] = {0,0};
+
+ /* Setup area to the full area...: */
+ GRECT area = {
+ .g_x = parmblock->pb_x,
+ .g_y = parmblock->pb_y,
+ .g_w = parmblock->pb_w-8,
+ .g_h = parmblock->pb_h
+ };
+
+ /* Setup clip: */
+ GRECT clip = {
+ .g_x = parmblock->pb_xc,
+ .g_y = parmblock->pb_yc,
+ .g_w = parmblock->pb_wc,
+ .g_h = parmblock->pb_hc
+ };
+
+ if(parmblock->pb_currstate == parmblock->pb_prevstate){
+
+ content = (char*)parmblock->pb_parm;
+ content_len = strlen(content);
+ cur_x = area.g_x;
+ cur_y = area.g_y;
+
+
+ if(!rc_intersect(&area, &clip)){
+ return (0);
+ }
+
+ pxy[0] = clip.g_x;
+ pxy[1] = clip.g_y;
+ pxy[2] = pxy[0] + clip.g_w-1;
+ pxy[3] = pxy[1] + clip.g_h-1;
+ vs_clip(vdihandle, 1, pxy);
+ vst_alignment(vdihandle, 0, 5, &dummy, &dummy);
+ vst_height(vdihandle, sys_sml_height, &dummy, &dummy, &dummy, &cheight);
+ vswr_mode(vdihandle, 2);
+
+ for (int i=0; i<content_len; i++) {
+ if (content[i] == '\n') {
+ cur_y += cheight;
+ cur_x = area.g_x;
+ } else {
+ if (cur_x >= clip.g_x
+ && cur_x < (clip.g_x + clip.g_w)
+ && cur_y > clip.g_y
+ && cur_y < (clip.g_w + clip.g_h)) {
+ c[0] = content[i];
+ v_gtext(vdihandle, cur_x, cur_y, c);
+ }
+ cur_x += cwidth;
+ }
+ }
+
+ vs_clip(vdihandle, 0, pxy);
+ }
+ return(0);
+}
+
+void atari_about_show(void)
+{
+ static USERBLK userblk;
+ short elem = 0;
+ const char * goto_url = NULL;
+ nserror nserr;
+ nsurl *url;
+
+ vdihandle = plot_get_vdi_handle();
+
+ infocontent = malloc(8000);
+ memset(infocontent, 0, 8000);
+
+ snprintf(infocontent, 8000,
+ "Netsurf : %s\n"
+ "Build ID : %s\n"
+ "Date : %s\n"
+ "MiNTLib : %d.%d-%d%s\n"
+ "GEMLib : %d.%d-%d%s\n"
+ "CFLib : %d.%d-%d%s\n"
+ "cURL : %s\n",
+ user_agent_string(),
+ WT_REVID,
+ WT_COMPILEDATE,
+ __MINTLIB_MAJOR__, __MINTLIB_MINOR__, __MINTLIB_REVISION__,
+ __MINTLIB_BETATAG__,
+ __GEMLIB_MAJOR__, __GEMLIB_MINOR__, __GEMLIB_REVISION__,
+ __GEMLIB_BETATAG__,
+ __CFLIB_MAJOR__, __CFLIB_MINOR__, __CFLIB_REVISION__,
+ __CFLIB_BETATAG__,
+ LIBCURL_VERSION);
+
+ about_form = gemtk_obj_get_tree(ABOUT);
+ snprintf(version, 32, "%s%s", "NetSurf ", (char*)netsurf_version);
+ set_string(about_form, ABOUT_LBL_VERSION, version);
+
+ userblk.ub_code = about_userdraw;
+ userblk.ub_parm = (long) infocontent;
+ about_form[ABOUT_CONTENT].ob_spec.userblk = &userblk;
+
+ elem = simple_dial(about_form, 0);
+ switch (elem) {
+ case ABOUT_CREDITS:
+ goto_url = "about:credits";
+ break;
+
+ case ABOUT_LICENSE:
+ goto_url = "about:licence";
+ break;
+ };
+
+ free(infocontent);
+
+ if (goto_url != NULL) {
+ nserr = nsurl_create(goto_url, &url);
+ if (nserr == NSERROR_OK) {
+ nserr = browser_window_create(BROWSER_WINDOW_VERIFIABLE |
+ BROWSER_WINDOW_HISTORY,
+ url,
+ NULL,
+ NULL,
+ NULL);
+ nsurl_unref(url);
+ }
+ if (nserr != NSERROR_OK) {
+ warn_user(messages_get_errorcode(nserr), 0);
+ }
+ }
+/*
+ dlg = open_mdial(about_form, 0);
+ do {
+ elem = do_mdial(dlg);
+ printf ("elem: %d\n", elem);
+ switch (elem) {
+ case ABOUT_OK:
+ close_dlg = true;
+ break;
+
+ case ABOUT_CREDITS:
+ close_dlg = true;
+ break;
+
+ case ABOUT_LICENSE:
+ close_dlg = true;
+ break;
+ }
+ } while (close_dlg == false);
+
+ close_mdial(dlg);
+*/
+
+}
diff --git a/atari/about.h b/atari/about.h
new file mode 100644
index 0000000..db18250
--- /dev/null
+++ b/atari/about.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2013 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NS_ATARI_ABOUT_H_INCLUDED
+#define NS_ATARI_ABOUT_H_INCLUDED
+
+void atari_about_show(void);
+
+
+#endif // NS_ATARI_ABOUT_H_INCLUDED
diff --git a/atari/certview.c b/atari/certview.c
index bdc2a82..6877529 100644
--- a/atari/certview.c
+++ b/atari/certview.c
@@ -59,12 +59,12 @@ static void atari_sslcert_viewer_draw(struct core_window *cw, int x,
static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]);
static struct atari_treeview_callbacks atari_sslcert_viewer_treeview_callbacks = {
- .init_phase2 = atari_sslcert_viewer_init_phase2,
- .finish = atari_sslcert_viewer_finish,
- .draw = atari_sslcert_viewer_draw,
- .keypress = atari_sslcert_viewer_keypress,
- .mouse_action = atari_sslcert_viewer_mouse_action,
- .gemtk_user_func = handle_event
+ .init_phase2 = atari_sslcert_viewer_init_phase2,
+ .finish = atari_sslcert_viewer_finish,
+ .draw = atari_sslcert_viewer_draw,
+ .keypress = atari_sslcert_viewer_keypress,
+ .mouse_action = atari_sslcert_viewer_mouse_action,
+ .gemtk_user_func = handle_event
};
/* static functions */
@@ -158,6 +158,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
struct atari_sslcert_viewer_s *cvwin = NULL;
char *cur_url = NULL;
char *cur_title = NULL;
+ short retval = 0;
OBJECT *toolbar;
LOG((""));
@@ -191,7 +192,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
atari_treeview_get_grect(tv, TREEVIEW_AREA_TOOLBAR, &tb_area);
evnt_timer(150);
gemtk_wm_exec_redraw(gemtk_win, &tb_area);
-
+ retval = 1;
break;
case WM_CLOSED:
@@ -207,11 +208,14 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
sslcert_viewer_reject(cvwin->ssl_session_data);
}
atari_sslcert_viewer_destroy(cvwin);
+ retval = 1;
break;
default: break;
}
}
+
+ return(retval);
}
static void atari_sslcert_viewer_init(struct atari_sslcert_viewer_s * cvwin,
diff --git a/atari/cookies.c b/atari/cookies.c
index 4530a21..d057075 100644
--- a/atari/cookies.c
+++ b/atari/cookies.c
@@ -121,6 +121,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
struct gui_window * gw;
char *cur_url = NULL;
char *cur_title = NULL;
+ short retval = 0;
LOG((""));
@@ -150,14 +151,14 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
case WM_CLOSED:
atari_cookie_manager_close();
+ retval = 1;
break;
default: break;
}
}
- // TODO: implement selectable objects in toolbar API:
- // ObjcChange( OC_TOOLBAR, win, buff[4], ~SELECTED, OC_MSG );
+ return(retval);
}
void atari_cookie_manager_init(void)
diff --git a/atari/deskmenu.c b/atari/deskmenu.c
index eb1192b..183387e 100644
--- a/atari/deskmenu.c
+++ b/atari/deskmenu.c
@@ -19,6 +19,7 @@
#include "atari/misc.h"
#include "atari/gui.h"
#include "atari/findfile.h"
+#include "atari/about.h"
#include "atari/rootwin.h"
@@ -150,7 +151,8 @@ static void __CDECL evnt_menu(WINDOW * win, short buff[8])
*/
static void __CDECL menu_about(short item, short title, void *data)
-{
+{
+ /*
nsurl *url;
nserror error;
char buf[PATH_MAX];
@@ -173,6 +175,8 @@ static void __CDECL menu_about(short item, short title, void *data)
if (error != NSERROR_OK) {
warn_user(messages_get_errorcode(error), 0);
}
+ */
+ atari_about_show();
}
static void __CDECL menu_new_win(short item, short title, void *data)
diff --git a/atari/gemtk/guiwin.c b/atari/gemtk/guiwin.c
index b4020e0..18d873c 100644
--- a/atari/gemtk/guiwin.c
+++ b/atari/gemtk/guiwin.c
@@ -597,7 +597,9 @@ short gemtk_wm_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8]
case AP_TFAIL:
dest = gemtk_wm_find(msg[3]);
if (dest) {
- DEBUG_PRINT(("Found WM_ dest: %p (%d), flags: %d, cb: %p\n", dest, dest->handle, dest->flags, dest->handler_func));
+ DEBUG_PRINT(("Found WM_ dest: %p (%d), flags: %d, cb: %p\n",
+ dest, dest->handle, dest->flags,
+ dest->handler_func));
if (dest->flags&GEMTK_WM_FLAG_PREPROC_WM) {
retval = preproc_wm(dest, ev_out, msg);
if(((retval == 0)||(dest->flags&GEMTK_WM_FLAG_RECV_PREPROC_WM))) {
diff --git a/atari/history.c b/atari/history.c
index 487030f..90ed0b8 100644
--- a/atari/history.c
+++ b/atari/history.c
@@ -122,6 +122,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
struct gui_window * gw;
char *cur_url = NULL;
char *cur_title = NULL;
+ short retval = 0;
LOG((""));
@@ -173,14 +174,14 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
case WM_CLOSED:
atari_global_history_close();
+ retval = 1;
break;
default: break;
}
}
- // TODO: implement selectable objects in toolbar API:
- // ObjcChange( OC_TOOLBAR, win, buff[4], ~SELECTED, OC_MSG );
+ return(retval);
}
diff --git a/atari/hotlist.c b/atari/hotlist.c
index 95b1693..1644935 100644
--- a/atari/hotlist.c
+++ b/atari/hotlist.c
@@ -94,8 +94,13 @@ static void atari_hotlist_draw(struct core_window *cw, int x,
static void atari_hotlist_keypress(struct core_window *cw, uint32_t ucs4)
{
+ GUIWIN *gemtk_win;
+ GRECT area;
LOG(("ucs4: %lu\n", ucs4));
hotlist_keypress(ucs4);
+ gemtk_win = atari_treeview_get_gemtk_window(cw);
+ atari_treeview_get_grect(cw, TREEVIEW_AREA_CONTENT, &area);
+ //gemtk_wm_exec_redraw(gemtk_win, &area);
}
static void atari_hotlist_mouse_action(struct core_window *cw,
@@ -115,14 +120,15 @@ static void atari_hotlist_mouse_action(struct core_window *cw,
static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
- struct atari_treeview_window *tv=NULL;
- struct core_window *cw;
- GRECT tb_area;
- GUIWIN * gemtk_win;
- struct gui_window * gw;
char *cur_url = NULL;
char *cur_title = NULL;
+ short retval = 0;
+ struct atari_treeview_window *tv = NULL;
+ struct core_window *cw;
+ struct gui_window * gw;
OBJECT *toolbar;
+ GRECT tb_area;
+ GUIWIN * gemtk_win;
LOG((""));
@@ -160,9 +166,6 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
case TOOLBAR_HOTLIST_DELETE:
hotlist_keypress(KEY_DELETE_LEFT);
- // TODO: check if redraw is really required,
- // - implement treeview getter for the gemtk
- // handle.
break;
case TOOLBAR_HOTLIST_EDIT:
@@ -176,18 +179,19 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
atari_treeview_get_grect(cw, TREEVIEW_AREA_TOOLBAR, &tb_area);
evnt_timer(150);
gemtk_wm_exec_redraw(gemtk_win, &tb_area);
+ retval = 1;
break;
case WM_CLOSED:
atari_hotlist_close();
+ retval = 1;
break;
default: break;
}
}
- // TODO: implement selectable objects in toolbar API:
- // ObjcChange( OC_TOOLBAR, win, buff[4], ~SELECTED, OC_MSG );
+ return(retval);
}
diff --git a/atari/res/netsurf.rsc b/atari/res/netsurf.rsc
index b5ea38b..37cdcc2 100755
Binary files a/atari/res/netsurf.rsc and b/atari/res/netsurf.rsc differ
diff --git a/atari/res/netsurf.rsh b/atari/res/netsurf.rsh
index 0396841..54c88d6 100755
--- a/atari/res/netsurf.rsh
+++ b/atari/res/netsurf.rsh
@@ -111,6 +111,11 @@
#define DOWNLOAD_CB_CLOSE_RDY 9 /* BOXCHAR in tree DOWNLOAD */
#define ABOUT 10 /* form/dial */
+#define ABOUT_LBL_VERSION 1 /* TEXT in tree ABOUT */
+#define ABOUT_OK 4 /* BUTTON in tree ABOUT */
+#define ABOUT_CONTENT 6 /* USERDEF in tree ABOUT */
+#define ABOUT_CREDITS 7 /* BUTTON in tree ABOUT */
+#define ABOUT_LICENSE 8 /* BUTTON in tree ABOUT */
#define POP_CTX 11 /* form/dial */
#define POP_CTX_CUT_SEL 1 /* TEXT in tree POP_CTX */
diff --git a/atari/res/netsurf.rsm b/atari/res/netsurf.rsm
index e279d4a..75a7b46 100755
--- a/atari/res/netsurf.rsm
+++ b/atari/res/netsurf.rsm
@@ -3,7 +3,7 @@ ResourceMaster v3.65
#N 99@32@AZAaza___ _@AZAaza090___ _@@_@
#FoC-Header@rsm2out@C-Header@rsh@@@[C-Header@0@
#R 0@0@1@1@2@1@
-#M 20010100@0@7728@646@
+#M 20010100@0@7728@652@
#T 0@1@MAINMENU@@64@@
#O 4@32@T_FILE@@
#O 5@32@T_EDIT@@
@@ -103,7 +103,12 @@ ResourceMaster v3.65
#O 7@21@LBL_PERCENT@@
#O 8@21@LBL_SPEED@@
#O 9@27@CB_CLOSE_RDY@@
-#T 10@2@ABOUT@@2@@
+#T 10@2@ABOUT@@9@@
+#O 1@21@LBL_VERSION@@
+#O 4@26@OK@@
+#O 6@24@CONTENT@@
+#O 7@26@CREDITS@@
+#O 8@26@LICENSE@@
#T 11@2@POP_CTX@@12@@
#O 1@21@CUT_SEL@@
#O 2@21@COPY_SEL@@
@@ -201,4 +206,4 @@ ResourceMaster v3.65
#T 17@2@TOOLBAR_HISTORY@@1@@
#T 18@2@TOOLBAR_SSL_CERT@@2@@
#O 1@26@TRUSTED@@
-#c 26341@
+#c 28820@
diff --git a/atari/toolbar.h b/atari/toolbar.h
index 3116aa9..16c4eb2 100644
--- a/atari/toolbar.h
+++ b/atari/toolbar.h
@@ -1,3 +1,21 @@
+/*
+ * Copyright 2013 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
#ifndef NS_ATARI_TOOLBAR_H
#define NS_ATARI_TOOLBAR_H
diff --git a/atari/treeview.c b/atari/treeview.c
index b4aafa9..fe92a02 100644
--- a/atari/treeview.c
+++ b/atari/treeview.c
@@ -158,6 +158,7 @@ static void atari_treeview_dump_info(struct atari_treeview_window *tv,
void atari_treeview_redraw(struct core_window *cw)
{
struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
+ short pxy[4];
if (tv != NULL && tv->is_open) {
if( tv->redraw && ((plot_get_flags() & PLOT_FLAG_OFFSCREEN) == 0) ) {
@@ -170,6 +171,17 @@ void atari_treeview_redraw(struct core_window *cw)
gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &work);
slid = gemtk_wm_get_scroll_info(tv->window);
+// // Debug code: this 3 lines help to inspect the redraw
+// // areas...
+// pxy[0] = work.g_x;
+// pxy[1] = work.g_y;
+// pxy[2] = pxy[0] + work.g_w-1;
+// pxy[3] = pxy[1] + work.g_h-1;
+//
+// vsf_color(plot_get_vdi_handle(), 0);
+// v_bar(plot_get_vdi_handle(), (short*)&pxy);
+// evnt_timer(500);
+
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
@@ -183,8 +195,6 @@ void atari_treeview_redraw(struct core_window *cw)
&todo[0], &todo[1], &todo[2], &todo[3] )!=0 ) {
while (todo[2] && todo[3]) {
- short pxy[4];
-
if(!rc_intersect(&work, (GRECT*)&todo)){
if (wind_get(handle, WF_NEXTXYWH,
&todo[0], &todo[1], &todo[2], &todo[3])==0) {
@@ -200,11 +210,11 @@ void atari_treeview_redraw(struct core_window *cw)
// Debug code: this 3 lines help to inspect the redraw
// areas...
- /*
- vsf_color(plot_get_vdi_handle(), 3);
- v_bar(plot_get_vdi_handle(), (short*)&pxy);
- evnt_timer(500);
- */
+
+// vsf_color(plot_get_vdi_handle(), 3);
+// v_bar(plot_get_vdi_handle(), (short*)&pxy);
+// evnt_timer(500);
+
/* convert screen to treeview coords: */
todo[0] = todo[0] - work.g_x ;//+ slid->x_pos*slid->x_unit_px;
@@ -390,6 +400,7 @@ void atari_treeview_redraw(struct core_window *cw)
*/
static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
+ short retval = 0;
struct atari_treeview_window *tv = (struct atari_treeview_window *)
gemtk_wm_get_user_data(win);
struct core_window *cw = (struct core_window *)tv;
@@ -419,7 +430,8 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
tv->io->gemtk_user_func(win, ev_out, msg);
}
- return(0);
+ // TODO: evaluate return values of event handler functions and pass them on:
+ return(retval);
}
@@ -746,13 +758,15 @@ void atari_treeview_redraw_request(struct core_window *cw, const struct rect *r)
RECT_TO_GRECT(r, &area)
+ assert(tv);
+
slid = gemtk_wm_get_scroll_info(tv->window);
//dbg_rect("redraw rect request", r);
// treeview redraw is always full window width:
area.g_x = 0;
- area.g_w = area.g_w;
+ area.g_w = 8000;
// but vertical redraw region is clipped:
area.g_y = r->y0 - (slid->y_pos*slid->y_unit_px);
area.g_h = r->y1 - r->y0;
diff --git a/atari/treeview.h b/atari/treeview.h
index fb4e659..4412b1d 100644
--- a/atari/treeview.h
+++ b/atari/treeview.h
@@ -23,6 +23,11 @@
#include "atari/gui.h"
#include "atari/gemtk/gemtk.h"
+/**
+ * Default AES Window widgets for a treeview window, can be passed to
+ * atari_treeview_create as the flags parameter to have an standardized treeview
+ * window.
+ */
#define ATARI_TREEVIEW_WIDGETS (CLOSER | MOVER | SIZER| NAME | FULLER | \
SMALLER | VSLIDE | HSLIDE | UPARROW | DNARROW \
| LFARROW | RTARROW)
@@ -36,9 +41,14 @@ enum treeview_area_e {
struct core_window;
struct atari_treeview_window;
-typedef struct atari_treeview_window *ATARI_TREEVIEW_PTR;
+/**
+ * The atari treeview implementation wraps the core_window callbacks
+ * So that it can process parameters and then it passes the event further
+ * To the specific implementation window.
+ * These callbacks must be implemented by any atari treeview window.
+ */
-// TODO: add drag_status callback!!
+// TODO: add drag_status callback
typedef nserror (*atari_treeview_init2_callback)(struct core_window *cw,
struct core_window_callback_table * default_callbacks);
typedef void (*atari_treeview_finish_callback)(struct core_window *cw);
@@ -60,20 +70,65 @@ struct atari_treeview_callbacks {
gemtk_wm_event_handler_f gemtk_user_func;
};
+/**
+ * Initalize an window to be an treeview window.
+ *
+*/
struct core_window *atari_treeview_create(GUIWIN *win,
struct atari_treeview_callbacks * callbacks,
void * user_data, uint32_t flags);
+/**
+ * Free the Treeview, but not the gemtk window used for the treeview.
+*/
void atari_treeview_delete(struct core_window *cw);
+
+/**
+ * Open the treeview window.
+ */
void atari_treeview_open(struct core_window *cw, GRECT *pos);
+
+/**
+ * Returns the window "open" state.
+*/
bool atari_treeview_is_open(struct core_window *cw);
+
+/**
+ * Closes (hides) the treeview window.
+*/
void atari_treeview_close(struct core_window *cw);
+
+/**
+ * Get the window manager window handle
+ */
+
GUIWIN * atari_treeview_get_gemtk_window(struct core_window *cw);
+
+/**
+ * Get an specific area inside the window.
+*/
void atari_treeview_get_grect(struct core_window *cw, enum treeview_area_e mode,
GRECT *dest);
+
+/**
+ * Process all pending redraw requests for a single treeview
+ */
void atari_treeview_redraw(struct core_window *cw);
+
+/**
+ * Attach arbitary user data to the treeview.
+*/
void atari_treeview_set_user_data(struct core_window *cw,
void *user_data_ptr);
+
+/**
+ * Return the arbitary user data set by atari_treeview_set_user_data()
+ */
void *atari_treeview_get_user_data(struct core_window *cw);
+
+/**
+ * Process all redraw request of all open Treeview windows
+*/
void atari_treeview_flush_redraws(void);
+
#endif //NSATARI_TREEVIEW_H
-----------------------------------------------------------------------
Summary of changes:
atari/Makefile.target | 1 +
atari/about.c | 208 +++++++++++++++++++++++++++++++++++++++++++++
atari/{font.h => about.h} | 44 +++++-----
atari/certview.c | 18 +++--
atari/cookies.c | 5 +-
atari/deskmenu.c | 6 +-
atari/gemtk/guiwin.c | 4 +-
atari/history.c | 5 +-
atari/hotlist.c | 24 +++--
atari/res/netsurf.rsc | Bin 34782 -> 38082 bytes
atari/res/netsurf.rsh | 5 +
atari/res/netsurf.rsm | 11 ++-
atari/toolbar.h | 18 ++++
atari/treeview.c | 32 +++++--
atari/treeview.h | 59 ++++++++++++-
15 files changed, 381 insertions(+), 59 deletions(-)
create mode 100644 atari/about.c
copy atari/{font.h => about.h} (78%)
mode change 100755 => 100644
diff --git a/atari/Makefile.target b/atari/Makefile.target
index a8bc65a..b2530cf 100644
--- a/atari/Makefile.target
+++ b/atari/Makefile.target
@@ -75,6 +75,7 @@ LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib
# S_ATARI are sources purely for the Atari FreeMiNT build
S_ATARI := \
+ about.c \
bitmap.c \
clipboard.c \
ctxmenu.c \
diff --git a/atari/about.c b/atari/about.c
new file mode 100644
index 0000000..f09dfb3
--- /dev/null
+++ b/atari/about.c
@@ -0,0 +1,208 @@
+/*
+ * Copyright 2013 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <limits.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "cflib.h"
+#include "atari/misc.h"
+#include "atari/plot/plot.h"
+#include "atari/gemtk/gemtk.h"
+#include "atari/res/netsurf.rsh"
+#include "atari/about.h"
+
+#include "utils/testament.h"
+#include "utils/useragent.h"
+#include "desktop/netsurf.h"
+#include "utils/nsurl.h"
+#include "utils/messages.h"
+
+
+#include "curl/curlver.h"
+
+
+static OBJECT * about_form = NULL;
+static char * infocontent;
+static char version[32];
+VdiHdl vdihandle;
+
+
+static short __CDECL about_userdraw(PARMBLK *parmblock)
+{
+ short pxy[8];
+ short dummy;
+ int content_len;
+ char *content;
+ short cur_x, cur_y;
+ short cheight = 8, cwidth = gl_wchar;
+ char c[2] = {0,0};
+
+ /* Setup area to the full area...: */
+ GRECT area = {
+ .g_x = parmblock->pb_x,
+ .g_y = parmblock->pb_y,
+ .g_w = parmblock->pb_w-8,
+ .g_h = parmblock->pb_h
+ };
+
+ /* Setup clip: */
+ GRECT clip = {
+ .g_x = parmblock->pb_xc,
+ .g_y = parmblock->pb_yc,
+ .g_w = parmblock->pb_wc,
+ .g_h = parmblock->pb_hc
+ };
+
+ if(parmblock->pb_currstate == parmblock->pb_prevstate){
+
+ content = (char*)parmblock->pb_parm;
+ content_len = strlen(content);
+ cur_x = area.g_x;
+ cur_y = area.g_y;
+
+
+ if(!rc_intersect(&area, &clip)){
+ return (0);
+ }
+
+ pxy[0] = clip.g_x;
+ pxy[1] = clip.g_y;
+ pxy[2] = pxy[0] + clip.g_w-1;
+ pxy[3] = pxy[1] + clip.g_h-1;
+ vs_clip(vdihandle, 1, pxy);
+ vst_alignment(vdihandle, 0, 5, &dummy, &dummy);
+ vst_height(vdihandle, sys_sml_height, &dummy, &dummy, &dummy, &cheight);
+ vswr_mode(vdihandle, 2);
+
+ for (int i=0; i<content_len; i++) {
+ if (content[i] == '\n') {
+ cur_y += cheight;
+ cur_x = area.g_x;
+ } else {
+ if (cur_x >= clip.g_x
+ && cur_x < (clip.g_x + clip.g_w)
+ && cur_y > clip.g_y
+ && cur_y < (clip.g_w + clip.g_h)) {
+ c[0] = content[i];
+ v_gtext(vdihandle, cur_x, cur_y, c);
+ }
+ cur_x += cwidth;
+ }
+ }
+
+ vs_clip(vdihandle, 0, pxy);
+ }
+ return(0);
+}
+
+void atari_about_show(void)
+{
+ static USERBLK userblk;
+ short elem = 0;
+ const char * goto_url = NULL;
+ nserror nserr;
+ nsurl *url;
+
+ vdihandle = plot_get_vdi_handle();
+
+ infocontent = malloc(8000);
+ memset(infocontent, 0, 8000);
+
+ snprintf(infocontent, 8000,
+ "Netsurf : %s\n"
+ "Build ID : %s\n"
+ "Date : %s\n"
+ "MiNTLib : %d.%d-%d%s\n"
+ "GEMLib : %d.%d-%d%s\n"
+ "CFLib : %d.%d-%d%s\n"
+ "cURL : %s\n",
+ user_agent_string(),
+ WT_REVID,
+ WT_COMPILEDATE,
+ __MINTLIB_MAJOR__, __MINTLIB_MINOR__, __MINTLIB_REVISION__,
+ __MINTLIB_BETATAG__,
+ __GEMLIB_MAJOR__, __GEMLIB_MINOR__, __GEMLIB_REVISION__,
+ __GEMLIB_BETATAG__,
+ __CFLIB_MAJOR__, __CFLIB_MINOR__, __CFLIB_REVISION__,
+ __CFLIB_BETATAG__,
+ LIBCURL_VERSION);
+
+ about_form = gemtk_obj_get_tree(ABOUT);
+ snprintf(version, 32, "%s%s", "NetSurf ", (char*)netsurf_version);
+ set_string(about_form, ABOUT_LBL_VERSION, version);
+
+ userblk.ub_code = about_userdraw;
+ userblk.ub_parm = (long) infocontent;
+ about_form[ABOUT_CONTENT].ob_spec.userblk = &userblk;
+
+ elem = simple_dial(about_form, 0);
+ switch (elem) {
+ case ABOUT_CREDITS:
+ goto_url = "about:credits";
+ break;
+
+ case ABOUT_LICENSE:
+ goto_url = "about:licence";
+ break;
+ };
+
+ free(infocontent);
+
+ if (goto_url != NULL) {
+ nserr = nsurl_create(goto_url, &url);
+ if (nserr == NSERROR_OK) {
+ nserr = browser_window_create(BROWSER_WINDOW_VERIFIABLE |
+ BROWSER_WINDOW_HISTORY,
+ url,
+ NULL,
+ NULL,
+ NULL);
+ nsurl_unref(url);
+ }
+ if (nserr != NSERROR_OK) {
+ warn_user(messages_get_errorcode(nserr), 0);
+ }
+ }
+/*
+ dlg = open_mdial(about_form, 0);
+ do {
+ elem = do_mdial(dlg);
+ printf ("elem: %d\n", elem);
+ switch (elem) {
+ case ABOUT_OK:
+ close_dlg = true;
+ break;
+
+ case ABOUT_CREDITS:
+ close_dlg = true;
+ break;
+
+ case ABOUT_LICENSE:
+ close_dlg = true;
+ break;
+ }
+ } while (close_dlg == false);
+
+ close_mdial(dlg);
+*/
+
+}
diff --git a/atari/font.h b/atari/about.h
old mode 100755
new mode 100644
similarity index 78%
copy from atari/font.h
copy to atari/about.h
index 2717497..db18250
--- a/atari/font.h
+++ b/atari/about.h
@@ -1,25 +1,25 @@
-/*
- * Copyright 2010 Ole Loots <ole(a)monochrom.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NS_ATARI_FONT_H
-#define NS_ATARI_FONT_H
+/*
+ * Copyright 2013 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef NS_ATARI_ABOUT_H_INCLUDED
+#define NS_ATARI_ABOUT_H_INCLUDED
+
+void atari_about_show(void);
-#endif /* NETSURF_FB_FONT_H */
-
+#endif // NS_ATARI_ABOUT_H_INCLUDED
diff --git a/atari/certview.c b/atari/certview.c
index bdc2a82..6877529 100644
--- a/atari/certview.c
+++ b/atari/certview.c
@@ -59,12 +59,12 @@ static void atari_sslcert_viewer_draw(struct core_window *cw, int x,
static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]);
static struct atari_treeview_callbacks atari_sslcert_viewer_treeview_callbacks = {
- .init_phase2 = atari_sslcert_viewer_init_phase2,
- .finish = atari_sslcert_viewer_finish,
- .draw = atari_sslcert_viewer_draw,
- .keypress = atari_sslcert_viewer_keypress,
- .mouse_action = atari_sslcert_viewer_mouse_action,
- .gemtk_user_func = handle_event
+ .init_phase2 = atari_sslcert_viewer_init_phase2,
+ .finish = atari_sslcert_viewer_finish,
+ .draw = atari_sslcert_viewer_draw,
+ .keypress = atari_sslcert_viewer_keypress,
+ .mouse_action = atari_sslcert_viewer_mouse_action,
+ .gemtk_user_func = handle_event
};
/* static functions */
@@ -158,6 +158,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
struct atari_sslcert_viewer_s *cvwin = NULL;
char *cur_url = NULL;
char *cur_title = NULL;
+ short retval = 0;
OBJECT *toolbar;
LOG((""));
@@ -191,7 +192,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
atari_treeview_get_grect(tv, TREEVIEW_AREA_TOOLBAR, &tb_area);
evnt_timer(150);
gemtk_wm_exec_redraw(gemtk_win, &tb_area);
-
+ retval = 1;
break;
case WM_CLOSED:
@@ -207,11 +208,14 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
sslcert_viewer_reject(cvwin->ssl_session_data);
}
atari_sslcert_viewer_destroy(cvwin);
+ retval = 1;
break;
default: break;
}
}
+
+ return(retval);
}
static void atari_sslcert_viewer_init(struct atari_sslcert_viewer_s * cvwin,
diff --git a/atari/cookies.c b/atari/cookies.c
index 4530a21..d057075 100644
--- a/atari/cookies.c
+++ b/atari/cookies.c
@@ -121,6 +121,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
struct gui_window * gw;
char *cur_url = NULL;
char *cur_title = NULL;
+ short retval = 0;
LOG((""));
@@ -150,14 +151,14 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
case WM_CLOSED:
atari_cookie_manager_close();
+ retval = 1;
break;
default: break;
}
}
- // TODO: implement selectable objects in toolbar API:
- // ObjcChange( OC_TOOLBAR, win, buff[4], ~SELECTED, OC_MSG );
+ return(retval);
}
void atari_cookie_manager_init(void)
diff --git a/atari/deskmenu.c b/atari/deskmenu.c
index eb1192b..183387e 100644
--- a/atari/deskmenu.c
+++ b/atari/deskmenu.c
@@ -19,6 +19,7 @@
#include "atari/misc.h"
#include "atari/gui.h"
#include "atari/findfile.h"
+#include "atari/about.h"
#include "atari/rootwin.h"
@@ -150,7 +151,8 @@ static void __CDECL evnt_menu(WINDOW * win, short buff[8])
*/
static void __CDECL menu_about(short item, short title, void *data)
-{
+{
+ /*
nsurl *url;
nserror error;
char buf[PATH_MAX];
@@ -173,6 +175,8 @@ static void __CDECL menu_about(short item, short title, void *data)
if (error != NSERROR_OK) {
warn_user(messages_get_errorcode(error), 0);
}
+ */
+ atari_about_show();
}
static void __CDECL menu_new_win(short item, short title, void *data)
diff --git a/atari/gemtk/guiwin.c b/atari/gemtk/guiwin.c
index b4020e0..18d873c 100644
--- a/atari/gemtk/guiwin.c
+++ b/atari/gemtk/guiwin.c
@@ -597,7 +597,9 @@ short gemtk_wm_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8]
case AP_TFAIL:
dest = gemtk_wm_find(msg[3]);
if (dest) {
- DEBUG_PRINT(("Found WM_ dest: %p (%d), flags: %d, cb: %p\n", dest, dest->handle, dest->flags, dest->handler_func));
+ DEBUG_PRINT(("Found WM_ dest: %p (%d), flags: %d, cb: %p\n",
+ dest, dest->handle, dest->flags,
+ dest->handler_func));
if (dest->flags&GEMTK_WM_FLAG_PREPROC_WM) {
retval = preproc_wm(dest, ev_out, msg);
if(((retval == 0)||(dest->flags&GEMTK_WM_FLAG_RECV_PREPROC_WM))) {
diff --git a/atari/history.c b/atari/history.c
index 487030f..90ed0b8 100644
--- a/atari/history.c
+++ b/atari/history.c
@@ -122,6 +122,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
struct gui_window * gw;
char *cur_url = NULL;
char *cur_title = NULL;
+ short retval = 0;
LOG((""));
@@ -173,14 +174,14 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
case WM_CLOSED:
atari_global_history_close();
+ retval = 1;
break;
default: break;
}
}
- // TODO: implement selectable objects in toolbar API:
- // ObjcChange( OC_TOOLBAR, win, buff[4], ~SELECTED, OC_MSG );
+ return(retval);
}
diff --git a/atari/hotlist.c b/atari/hotlist.c
index 95b1693..1644935 100644
--- a/atari/hotlist.c
+++ b/atari/hotlist.c
@@ -94,8 +94,13 @@ static void atari_hotlist_draw(struct core_window *cw, int x,
static void atari_hotlist_keypress(struct core_window *cw, uint32_t ucs4)
{
+ GUIWIN *gemtk_win;
+ GRECT area;
LOG(("ucs4: %lu\n", ucs4));
hotlist_keypress(ucs4);
+ gemtk_win = atari_treeview_get_gemtk_window(cw);
+ atari_treeview_get_grect(cw, TREEVIEW_AREA_CONTENT, &area);
+ //gemtk_wm_exec_redraw(gemtk_win, &area);
}
static void atari_hotlist_mouse_action(struct core_window *cw,
@@ -115,14 +120,15 @@ static void atari_hotlist_mouse_action(struct core_window *cw,
static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
- struct atari_treeview_window *tv=NULL;
- struct core_window *cw;
- GRECT tb_area;
- GUIWIN * gemtk_win;
- struct gui_window * gw;
char *cur_url = NULL;
char *cur_title = NULL;
+ short retval = 0;
+ struct atari_treeview_window *tv = NULL;
+ struct core_window *cw;
+ struct gui_window * gw;
OBJECT *toolbar;
+ GRECT tb_area;
+ GUIWIN * gemtk_win;
LOG((""));
@@ -160,9 +166,6 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
case TOOLBAR_HOTLIST_DELETE:
hotlist_keypress(KEY_DELETE_LEFT);
- // TODO: check if redraw is really required,
- // - implement treeview getter for the gemtk
- // handle.
break;
case TOOLBAR_HOTLIST_EDIT:
@@ -176,18 +179,19 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
atari_treeview_get_grect(cw, TREEVIEW_AREA_TOOLBAR, &tb_area);
evnt_timer(150);
gemtk_wm_exec_redraw(gemtk_win, &tb_area);
+ retval = 1;
break;
case WM_CLOSED:
atari_hotlist_close();
+ retval = 1;
break;
default: break;
}
}
- // TODO: implement selectable objects in toolbar API:
- // ObjcChange( OC_TOOLBAR, win, buff[4], ~SELECTED, OC_MSG );
+ return(retval);
}
diff --git a/atari/res/netsurf.rsc b/atari/res/netsurf.rsc
index b5ea38b..37cdcc2 100755
Binary files a/atari/res/netsurf.rsc and b/atari/res/netsurf.rsc differ
diff --git a/atari/res/netsurf.rsh b/atari/res/netsurf.rsh
index 0396841..54c88d6 100755
--- a/atari/res/netsurf.rsh
+++ b/atari/res/netsurf.rsh
@@ -111,6 +111,11 @@
#define DOWNLOAD_CB_CLOSE_RDY 9 /* BOXCHAR in tree DOWNLOAD */
#define ABOUT 10 /* form/dial */
+#define ABOUT_LBL_VERSION 1 /* TEXT in tree ABOUT */
+#define ABOUT_OK 4 /* BUTTON in tree ABOUT */
+#define ABOUT_CONTENT 6 /* USERDEF in tree ABOUT */
+#define ABOUT_CREDITS 7 /* BUTTON in tree ABOUT */
+#define ABOUT_LICENSE 8 /* BUTTON in tree ABOUT */
#define POP_CTX 11 /* form/dial */
#define POP_CTX_CUT_SEL 1 /* TEXT in tree POP_CTX */
diff --git a/atari/res/netsurf.rsm b/atari/res/netsurf.rsm
index e279d4a..75a7b46 100755
--- a/atari/res/netsurf.rsm
+++ b/atari/res/netsurf.rsm
@@ -3,7 +3,7 @@ ResourceMaster v3.65
#N 99@32@AZAaza___ _@AZAaza090___ _@@_@
#FoC-Header@rsm2out@C-Header@rsh@@@[C-Header@0@
#R 0@0@1@1@2@1@
-#M 20010100@0@7728@646@
+#M 20010100@0@7728@652@
#T 0@1@MAINMENU@@64@@
#O 4@32@T_FILE@@
#O 5@32@T_EDIT@@
@@ -103,7 +103,12 @@ ResourceMaster v3.65
#O 7@21@LBL_PERCENT@@
#O 8@21@LBL_SPEED@@
#O 9@27@CB_CLOSE_RDY@@
-#T 10@2@ABOUT@@2@@
+#T 10@2@ABOUT@@9@@
+#O 1@21@LBL_VERSION@@
+#O 4@26@OK@@
+#O 6@24@CONTENT@@
+#O 7@26@CREDITS@@
+#O 8@26@LICENSE@@
#T 11@2@POP_CTX@@12@@
#O 1@21@CUT_SEL@@
#O 2@21@COPY_SEL@@
@@ -201,4 +206,4 @@ ResourceMaster v3.65
#T 17@2@TOOLBAR_HISTORY@@1@@
#T 18@2@TOOLBAR_SSL_CERT@@2@@
#O 1@26@TRUSTED@@
-#c 26341@
+#c 28820@
diff --git a/atari/toolbar.h b/atari/toolbar.h
index 3116aa9..16c4eb2 100644
--- a/atari/toolbar.h
+++ b/atari/toolbar.h
@@ -1,3 +1,21 @@
+/*
+ * Copyright 2013 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
#ifndef NS_ATARI_TOOLBAR_H
#define NS_ATARI_TOOLBAR_H
diff --git a/atari/treeview.c b/atari/treeview.c
index b4aafa9..fe92a02 100644
--- a/atari/treeview.c
+++ b/atari/treeview.c
@@ -158,6 +158,7 @@ static void atari_treeview_dump_info(struct atari_treeview_window *tv,
void atari_treeview_redraw(struct core_window *cw)
{
struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
+ short pxy[4];
if (tv != NULL && tv->is_open) {
if( tv->redraw && ((plot_get_flags() & PLOT_FLAG_OFFSCREEN) == 0) ) {
@@ -170,6 +171,17 @@ void atari_treeview_redraw(struct core_window *cw)
gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &work);
slid = gemtk_wm_get_scroll_info(tv->window);
+// // Debug code: this 3 lines help to inspect the redraw
+// // areas...
+// pxy[0] = work.g_x;
+// pxy[1] = work.g_y;
+// pxy[2] = pxy[0] + work.g_w-1;
+// pxy[3] = pxy[1] + work.g_h-1;
+//
+// vsf_color(plot_get_vdi_handle(), 0);
+// v_bar(plot_get_vdi_handle(), (short*)&pxy);
+// evnt_timer(500);
+
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
@@ -183,8 +195,6 @@ void atari_treeview_redraw(struct core_window *cw)
&todo[0], &todo[1], &todo[2], &todo[3] )!=0 ) {
while (todo[2] && todo[3]) {
- short pxy[4];
-
if(!rc_intersect(&work, (GRECT*)&todo)){
if (wind_get(handle, WF_NEXTXYWH,
&todo[0], &todo[1], &todo[2], &todo[3])==0) {
@@ -200,11 +210,11 @@ void atari_treeview_redraw(struct core_window *cw)
// Debug code: this 3 lines help to inspect the redraw
// areas...
- /*
- vsf_color(plot_get_vdi_handle(), 3);
- v_bar(plot_get_vdi_handle(), (short*)&pxy);
- evnt_timer(500);
- */
+
+// vsf_color(plot_get_vdi_handle(), 3);
+// v_bar(plot_get_vdi_handle(), (short*)&pxy);
+// evnt_timer(500);
+
/* convert screen to treeview coords: */
todo[0] = todo[0] - work.g_x ;//+ slid->x_pos*slid->x_unit_px;
@@ -390,6 +400,7 @@ void atari_treeview_redraw(struct core_window *cw)
*/
static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
+ short retval = 0;
struct atari_treeview_window *tv = (struct atari_treeview_window *)
gemtk_wm_get_user_data(win);
struct core_window *cw = (struct core_window *)tv;
@@ -419,7 +430,8 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
tv->io->gemtk_user_func(win, ev_out, msg);
}
- return(0);
+ // TODO: evaluate return values of event handler functions and pass them on:
+ return(retval);
}
@@ -746,13 +758,15 @@ void atari_treeview_redraw_request(struct core_window *cw, const struct rect *r)
RECT_TO_GRECT(r, &area)
+ assert(tv);
+
slid = gemtk_wm_get_scroll_info(tv->window);
//dbg_rect("redraw rect request", r);
// treeview redraw is always full window width:
area.g_x = 0;
- area.g_w = area.g_w;
+ area.g_w = 8000;
// but vertical redraw region is clipped:
area.g_y = r->y0 - (slid->y_pos*slid->y_unit_px);
area.g_h = r->y1 - r->y0;
diff --git a/atari/treeview.h b/atari/treeview.h
index fb4e659..4412b1d 100644
--- a/atari/treeview.h
+++ b/atari/treeview.h
@@ -23,6 +23,11 @@
#include "atari/gui.h"
#include "atari/gemtk/gemtk.h"
+/**
+ * Default AES Window widgets for a treeview window, can be passed to
+ * atari_treeview_create as the flags parameter to have an standardized treeview
+ * window.
+ */
#define ATARI_TREEVIEW_WIDGETS (CLOSER | MOVER | SIZER| NAME | FULLER | \
SMALLER | VSLIDE | HSLIDE | UPARROW | DNARROW \
| LFARROW | RTARROW)
@@ -36,9 +41,14 @@ enum treeview_area_e {
struct core_window;
struct atari_treeview_window;
-typedef struct atari_treeview_window *ATARI_TREEVIEW_PTR;
+/**
+ * The atari treeview implementation wraps the core_window callbacks
+ * So that it can process parameters and then it passes the event further
+ * To the specific implementation window.
+ * These callbacks must be implemented by any atari treeview window.
+ */
-// TODO: add drag_status callback!!
+// TODO: add drag_status callback
typedef nserror (*atari_treeview_init2_callback)(struct core_window *cw,
struct core_window_callback_table * default_callbacks);
typedef void (*atari_treeview_finish_callback)(struct core_window *cw);
@@ -60,20 +70,65 @@ struct atari_treeview_callbacks {
gemtk_wm_event_handler_f gemtk_user_func;
};
+/**
+ * Initalize an window to be an treeview window.
+ *
+*/
struct core_window *atari_treeview_create(GUIWIN *win,
struct atari_treeview_callbacks * callbacks,
void * user_data, uint32_t flags);
+/**
+ * Free the Treeview, but not the gemtk window used for the treeview.
+*/
void atari_treeview_delete(struct core_window *cw);
+
+/**
+ * Open the treeview window.
+ */
void atari_treeview_open(struct core_window *cw, GRECT *pos);
+
+/**
+ * Returns the window "open" state.
+*/
bool atari_treeview_is_open(struct core_window *cw);
+
+/**
+ * Closes (hides) the treeview window.
+*/
void atari_treeview_close(struct core_window *cw);
+
+/**
+ * Get the window manager window handle
+ */
+
GUIWIN * atari_treeview_get_gemtk_window(struct core_window *cw);
+
+/**
+ * Get an specific area inside the window.
+*/
void atari_treeview_get_grect(struct core_window *cw, enum treeview_area_e mode,
GRECT *dest);
+
+/**
+ * Process all pending redraw requests for a single treeview
+ */
void atari_treeview_redraw(struct core_window *cw);
+
+/**
+ * Attach arbitary user data to the treeview.
+*/
void atari_treeview_set_user_data(struct core_window *cw,
void *user_data_ptr);
+
+/**
+ * Return the arbitary user data set by atari_treeview_set_user_data()
+ */
void *atari_treeview_get_user_data(struct core_window *cw);
+
+/**
+ * Process all redraw request of all open Treeview windows
+*/
void atari_treeview_flush_redraws(void);
+
#endif //NSATARI_TREEVIEW_H
--
NetSurf Browser
9 years, 12 months
netsurf: branch mono/atari_treeview_rework updated. release/3.0-579-gdacd02e
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/dacd02e955d398e2556ae...
...commit http://git.netsurf-browser.org/netsurf.git/commit/dacd02e955d398e2556ae7f...
...tree http://git.netsurf-browser.org/netsurf.git/tree/dacd02e955d398e2556ae7f70...
The branch, mono/atari_treeview_rework has been updated
via dacd02e955d398e2556ae7f70de37b611d383c24 (commit)
from a19b32703b989d8eb3c3aeb14dc5bf824d1a5e72 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=dacd02e955d398e2556...
commit dacd02e955d398e2556ae7f70de37b611d383c24
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Removed old treeview files
diff --git a/atari/old_treeview/history.c b/atari/old_treeview/history.c
deleted file mode 100755
index 5447571..0000000
--- a/atari/old_treeview/history.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright 2010 Ole Loots <ole(a)monochrom.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <string.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include "desktop/browser.h"
-#include "utils/nsoption.h"
-#include "desktop/tree.h"
-#include "desktop/gui.h"
-#include "desktop/global_history.h"
-#include "desktop/browser.h"
-#include "utils/messages.h"
-#include "content/content.h"
-#include "content/hlcache.h"
-#include "content/urldb.h"
-#include "utils/log.h"
-#include "atari/treeview.h"
-#include "atari/findfile.h"
-#include "atari/res/netsurf.rsh"
-#include "atari/history.h"
-
-
-//TODO: remove/add guiwin handle on close / open - so that the list
-// is kept tiny.
-
-extern GRECT desk_area;
-
-struct s_atari_global_history gl_history;
-
-
-void atari_global_history_open( void )
-{
- /* TODO: call this in gui.c and move global_history_init() into history.c */
- atari_global_history_init();
- if (gl_history.init == false ) {
- return;
- }
- if( gl_history.open == false ) {
-
- GRECT pos;
- wind_get_grect(0, WF_WORKXYWH, &pos);
- pos.g_x = desk_area.g_w - desk_area.g_w / 4;
- pos.g_y = desk_area.g_y;
- pos.g_w = desk_area.g_w / 4;
- pos.g_h = desk_area.g_h;
-
- wind_open(gemtk_wm_get_handle(gl_history.window), pos.g_x, pos.g_y,
- pos.g_w, pos.g_h);
- gl_history.open = true;
- atari_treeview_open(gl_history.tv);
- } else {
- wind_set(gemtk_wm_get_handle(gl_history.window), WF_TOP, 1, 0, 0, 0);
- }
-}
-
-void atari_global_history_close( void )
-{
- wind_close(gemtk_wm_get_handle(gl_history.window));
- gl_history.open = false;
- atari_treeview_close(gl_history.tv);
-}
-
-static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
-{
- NSTREEVIEW tv=NULL;
-
- //printf("Hotlist event %d, open: %d\n", ev_out->emo_events, gl_history.open);
-
- if(ev_out->emo_events & MU_MESAG){
- switch (msg[0]) {
-
- case WM_CLOSED:
- atari_global_history_close();
- break;
-
- default: break;
- }
- }
-
- // TODO: implement selectable objects in toolbar API:
- // ObjcChange( OC_TOOLBAR, win, buff[4], ~SELECTED, OC_MSG );
-}
-
-/* TODO: add call to global_history_init() */
-bool atari_global_history_init( void )
-{
-
- if( gl_history.init == false ) {
-
- short handle;
- GRECT desk;
- int flags = ATARI_TREEVIEW_WIDGETS;
-
- // initialize state options:
- gl_history.open = false;
-
- // Create an AES window:
- handle = wind_create(flags, 40, 40, desk_area.g_w, desk_area.g_h);
-
- // add the AES window to the gemtk window manager:
- gl_history.window = gemtk_wm_add(handle, GEMTK_WM_FLAG_DEFAULTS, NULL);
-
- if( gl_history.window == NULL ) {
- LOG(("Failed to allocate history window"));
- return( false );
- }
-
- // Set window title:
- wind_set_str(handle, WF_NAME, (char*)messages_get("GlobalHistory"));
-
- // Make the window part of the netsurf treeview framework:
- gl_history.tv = atari_treeview_create(TREE_HISTORY,
- gl_history.window, handle_event);
-
- gemtk_wm_unlink(gl_history.window);
-
- if (gl_history.tv == NULL) {
- /* TODO: handle it properly, clean up previous allocs */
- LOG(("Failed to allocate history treeview"));
- return( false );
- }
-
- gl_history.init = true;
- }
- return( true );
-}
-
-
-void atari_global_history_destroy( void )
-{
-
- if( gl_history.init == false ) {
- return;
- }
- if( gl_history.window != NULL ) {
- if( gl_history.open )
- atari_global_history_close();
- wind_delete(gemtk_wm_get_handle(gl_history.window));
- gemtk_wm_remove(gl_history.window);
- gl_history.window = NULL;
- atari_treeview_destroy(gl_history.tv);
- gl_history.init = false;
- }
- LOG(("done"));
-}
-
-void atari_global_history_redraw( void )
-{
- atari_treeview_redraw( gl_history.tv );
-}
-
-
diff --git a/atari/old_treeview/history.h b/atari/old_treeview/history.h
deleted file mode 100755
index d94e188..0000000
--- a/atari/old_treeview/history.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2010 Ole Loots <ole(a)monochrom.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NS_ATARI_HISTORY_H
-#define NS_ATARI_HISTORY_H
-
-#include <stdbool.h>
-#include "desktop/tree.h"
-#include "atari/treeview.h"
-#include "atari/gemtk/gemtk.h"
-
-struct s_atari_global_history {
- GUIWIN *window; /*< The GEMTK window ref */
- NSTREEVIEW tv; /*< The history treeview handle. */
- bool open;
- bool init;
-};
-
-extern struct s_atari_global_history gl_history;
-
-bool atari_global_history_init( void );
-void atari_global_history_destroy( void );
-void atari_global_history_open( void );
-void atari_global_history_close( void );
-
-void atari_global_history_redraw( void );
-
-
-
-#endif
diff --git a/atari/old_treeview/hotlist.c b/atari/old_treeview/hotlist.c
deleted file mode 100755
index 57cf0c0..0000000
--- a/atari/old_treeview/hotlist.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright 2010 Ole Loots <ole(a)monochrom.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <ctype.h>
-#include <string.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-
-#include "desktop/browser.h"
-#include "content/content.h"
-#include "content/hlcache.h"
-#include "content/urldb.h"
-#include "utils/nsoption.h"
-#include "desktop/hotlist.h"
-#include "desktop/tree.h"
-#include "desktop/gui.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/utils.h"
-#include "utils/url.h"
-#include "atari/gui.h"
-#include "atari/misc.h"
-#include "atari/treeview.h"
-#include "atari/hotlist.h"
-#include "atari/findfile.h"
-#include "atari/gemtk/gemtk.h"
-#include "atari/res/netsurf.rsh"
-
-extern GRECT desk_area;
-
-struct atari_hotlist hl;
-
-static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
-{
- NSTREEVIEW tv=NULL;
- GRECT tb_area;
-
- if(ev_out->emo_events & MU_MESAG){
- switch (msg[0]) {
-
- case WM_TOOLBAR:
-
- tv = (NSTREEVIEW) gemtk_wm_get_user_data(win);
-
- switch (msg[4]) {
- case TOOLBAR_HOTLIST_CREATE_FOLDER:
- hotlist_add_folder(NULL, false, 0);
- break;
-
- case TOOLBAR_HOTLIST_ADD:
- atari_hotlist_add_page(NULL, NULL);
- break;
-
- case TOOLBAR_HOTLIST_DELETE:
- hotlist_keypress(KEY_DELETE_LEFT);
- gemtk_wm_exec_redraw(tv->window, NULL);
- break;
-
- case TOOLBAR_HOTLIST_EDIT:
- hotlist_edit_selection();
- break;
- }
-
- gemtk_obj_get_tree(TOOLBAR_HOTLIST)[msg[4]].ob_state &= ~OS_SELECTED;
- gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_TOOLBAR, &tb_area);
- evnt_timer(150);
- gemtk_wm_exec_redraw(tv->window, &tb_area);
- break;
-
- case WM_CLOSED:
- atari_hotlist_close();
- break;
-
- default: break;
- }
- }
-
- // TODO: implement selectable objects in toolbar API:
- // ObjcChange( OC_TOOLBAR, win, buff[4], ~SELECTED, OC_MSG );
-}
-
-
-
-void atari_hotlist_init(void)
-{
- if (hl.init == false) {
- if( strcmp(nsoption_charp(hotlist_file), "") == 0 ){
- atari_find_resource( (char*)&hl.path, "hotlist", "hotlist" );
- } else {
- strncpy( (char*)&hl.path, nsoption_charp(hotlist_file), PATH_MAX-1 );
- }
-
- LOG(("Hotlist: %s", (char*)&hl.path ));
-
- if( hl.window == NULL ){
- int flags = ATARI_TREEVIEW_WIDGETS;
- short handle = -1;
- GRECT desk;
- OBJECT * tree = gemtk_obj_get_tree(TOOLBAR_HOTLIST);
- assert( tree );
- hl.open = false;
-
- handle = wind_create(flags, 0, 0, desk_area.g_w, desk_area.g_h);
- hl.window = gemtk_wm_add(handle, GEMTK_WM_FLAG_DEFAULTS, NULL);
- if( hl.window == NULL ) {
- gemtk_msg_box_show(GEMTK_MSG_BOX_ALERT,
- "Failed to allocate Hotlist");
- return;
- }
- wind_set_str(handle, WF_NAME, (char*)messages_get("Hotlist"));
- gemtk_wm_set_toolbar(hl.window, tree, 0, 0);
- gemtk_wm_unlink(hl.window);
- tree_hotlist_path = (const char*)&hl.path;
- hl.tv = atari_treeview_create(
- TREE_HOTLIST,
- hl.window,
- handle_event
- );
- if (hl.tv == NULL) {
- /* handle it properly, clean up previous allocs */
- LOG(("Failed to allocate treeview"));
- return;
- }
-
- } else {
-
- }
- }
- hl.init = true;
-}
-
-
-void atari_hotlist_open(void)
-{
- if( hl.init == false ) {
- return;
- }
-
- if( hl.open == false ) {
-
- GRECT pos;
- pos.g_x = desk_area.g_w - desk_area.g_w / 4;
- pos.g_y = desk_area.g_y;
- pos.g_w = desk_area.g_w / 4;
- pos.g_h = desk_area.g_h;
-
- wind_open_grect(gemtk_wm_get_handle(hl.window), &pos);
- hl.open = true;
- atari_treeview_open( hl.tv );
- } else {
- wind_set(gemtk_wm_get_handle(hl.window), WF_TOP, 1, 0, 0, 0);
- }
-}
-
-void atari_hotlist_close(void)
-{
- wind_close(gemtk_wm_get_handle(hl.window));
- hl.open = false;
- atari_treeview_close(hl.tv);
-}
-
-void atari_hotlist_destroy(void)
-{
-
- if( hl.init == false) {
- return;
- }
- if( hl.window != NULL ) {
- if (hl.open)
- atari_hotlist_close();
- wind_delete(gemtk_wm_get_handle(hl.window));
- gemtk_wm_remove(hl.window);
- hl.window = NULL;
- atari_treeview_destroy(hl.tv);
- hl.init = false;
- }
- LOG(("done"));
-}
-
-void atari_hotlist_redraw(void)
-{
- int i = 01;
- atari_treeview_redraw(hl.tv);
-}
-
-struct node;
-
-void atari_hotlist_add_page( const char * url, const char * title )
-{
- struct node * root;
- struct node * selected = NULL;
- struct node * folder = NULL;
- nsurl *nsurl;
- NSTREEVIEW tv = hl.tv;
- if(hl.tv == NULL )
- return;
-
- atari_hotlist_open();
-
- if (nsurl_create(url, &nsurl) != NSERROR_OK)
- return;
-
- if( hl.tv->click.x >= 0 && hl.tv->click.y >= 0 ){
- hotlist_add_entry( nsurl, title, true, hl.tv->click.y );
- } else {
- hotlist_add_url( nsurl );
- }
- nsurl_unref(nsurl);
-}
diff --git a/atari/old_treeview/hotlist.h b/atari/old_treeview/hotlist.h
deleted file mode 100755
index fc9cba6..0000000
--- a/atari/old_treeview/hotlist.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2010 Ole Loots <ole(a)monochrom.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NS_ATARI_HOTLIST_H
-#define NS_ATARI_HOTLIST_H
-#include <stdbool.h>
-#include "desktop/tree.h"
-#include "atari/gemtk/gemtk.h"
-#include "atari/treeview.h"
-/* The hotlist window, toolbar and treeview data. */
-
-struct atari_hotlist {
- GUIWIN * window;
- NSTREEVIEW tv; /*< The hotlist treeview handle. */
- bool open;
- bool init;
- char path[PATH_MAX];
-};
-
-extern struct atari_hotlist hl;
-
-void atari_hotlist_init( void );
-void atari_hotlist_open( void );
-void atari_hotlist_close( void );
-void atari_hotlist_destroy( void );
-void atari_hotlist_add_page( const char * url, const char * title );
-
-void atari_hotlist_redraw( void );
-
-
-#endif
-----------------------------------------------------------------------
Summary of changes:
atari/old_treeview/history.c | 170 -------------------------------
atari/old_treeview/history.h | 45 ---------
atari/old_treeview/hotlist.c | 226 ------------------------------------------
atari/old_treeview/hotlist.h | 46 ---------
4 files changed, 0 insertions(+), 487 deletions(-)
delete mode 100755 atari/old_treeview/history.c
delete mode 100755 atari/old_treeview/history.h
delete mode 100755 atari/old_treeview/hotlist.c
delete mode 100755 atari/old_treeview/hotlist.h
diff --git a/atari/old_treeview/history.c b/atari/old_treeview/history.c
deleted file mode 100755
index 5447571..0000000
--- a/atari/old_treeview/history.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright 2010 Ole Loots <ole(a)monochrom.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <string.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include "desktop/browser.h"
-#include "utils/nsoption.h"
-#include "desktop/tree.h"
-#include "desktop/gui.h"
-#include "desktop/global_history.h"
-#include "desktop/browser.h"
-#include "utils/messages.h"
-#include "content/content.h"
-#include "content/hlcache.h"
-#include "content/urldb.h"
-#include "utils/log.h"
-#include "atari/treeview.h"
-#include "atari/findfile.h"
-#include "atari/res/netsurf.rsh"
-#include "atari/history.h"
-
-
-//TODO: remove/add guiwin handle on close / open - so that the list
-// is kept tiny.
-
-extern GRECT desk_area;
-
-struct s_atari_global_history gl_history;
-
-
-void atari_global_history_open( void )
-{
- /* TODO: call this in gui.c and move global_history_init() into history.c */
- atari_global_history_init();
- if (gl_history.init == false ) {
- return;
- }
- if( gl_history.open == false ) {
-
- GRECT pos;
- wind_get_grect(0, WF_WORKXYWH, &pos);
- pos.g_x = desk_area.g_w - desk_area.g_w / 4;
- pos.g_y = desk_area.g_y;
- pos.g_w = desk_area.g_w / 4;
- pos.g_h = desk_area.g_h;
-
- wind_open(gemtk_wm_get_handle(gl_history.window), pos.g_x, pos.g_y,
- pos.g_w, pos.g_h);
- gl_history.open = true;
- atari_treeview_open(gl_history.tv);
- } else {
- wind_set(gemtk_wm_get_handle(gl_history.window), WF_TOP, 1, 0, 0, 0);
- }
-}
-
-void atari_global_history_close( void )
-{
- wind_close(gemtk_wm_get_handle(gl_history.window));
- gl_history.open = false;
- atari_treeview_close(gl_history.tv);
-}
-
-static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
-{
- NSTREEVIEW tv=NULL;
-
- //printf("Hotlist event %d, open: %d\n", ev_out->emo_events, gl_history.open);
-
- if(ev_out->emo_events & MU_MESAG){
- switch (msg[0]) {
-
- case WM_CLOSED:
- atari_global_history_close();
- break;
-
- default: break;
- }
- }
-
- // TODO: implement selectable objects in toolbar API:
- // ObjcChange( OC_TOOLBAR, win, buff[4], ~SELECTED, OC_MSG );
-}
-
-/* TODO: add call to global_history_init() */
-bool atari_global_history_init( void )
-{
-
- if( gl_history.init == false ) {
-
- short handle;
- GRECT desk;
- int flags = ATARI_TREEVIEW_WIDGETS;
-
- // initialize state options:
- gl_history.open = false;
-
- // Create an AES window:
- handle = wind_create(flags, 40, 40, desk_area.g_w, desk_area.g_h);
-
- // add the AES window to the gemtk window manager:
- gl_history.window = gemtk_wm_add(handle, GEMTK_WM_FLAG_DEFAULTS, NULL);
-
- if( gl_history.window == NULL ) {
- LOG(("Failed to allocate history window"));
- return( false );
- }
-
- // Set window title:
- wind_set_str(handle, WF_NAME, (char*)messages_get("GlobalHistory"));
-
- // Make the window part of the netsurf treeview framework:
- gl_history.tv = atari_treeview_create(TREE_HISTORY,
- gl_history.window, handle_event);
-
- gemtk_wm_unlink(gl_history.window);
-
- if (gl_history.tv == NULL) {
- /* TODO: handle it properly, clean up previous allocs */
- LOG(("Failed to allocate history treeview"));
- return( false );
- }
-
- gl_history.init = true;
- }
- return( true );
-}
-
-
-void atari_global_history_destroy( void )
-{
-
- if( gl_history.init == false ) {
- return;
- }
- if( gl_history.window != NULL ) {
- if( gl_history.open )
- atari_global_history_close();
- wind_delete(gemtk_wm_get_handle(gl_history.window));
- gemtk_wm_remove(gl_history.window);
- gl_history.window = NULL;
- atari_treeview_destroy(gl_history.tv);
- gl_history.init = false;
- }
- LOG(("done"));
-}
-
-void atari_global_history_redraw( void )
-{
- atari_treeview_redraw( gl_history.tv );
-}
-
-
diff --git a/atari/old_treeview/history.h b/atari/old_treeview/history.h
deleted file mode 100755
index d94e188..0000000
--- a/atari/old_treeview/history.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2010 Ole Loots <ole(a)monochrom.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NS_ATARI_HISTORY_H
-#define NS_ATARI_HISTORY_H
-
-#include <stdbool.h>
-#include "desktop/tree.h"
-#include "atari/treeview.h"
-#include "atari/gemtk/gemtk.h"
-
-struct s_atari_global_history {
- GUIWIN *window; /*< The GEMTK window ref */
- NSTREEVIEW tv; /*< The history treeview handle. */
- bool open;
- bool init;
-};
-
-extern struct s_atari_global_history gl_history;
-
-bool atari_global_history_init( void );
-void atari_global_history_destroy( void );
-void atari_global_history_open( void );
-void atari_global_history_close( void );
-
-void atari_global_history_redraw( void );
-
-
-
-#endif
diff --git a/atari/old_treeview/hotlist.c b/atari/old_treeview/hotlist.c
deleted file mode 100755
index 57cf0c0..0000000
--- a/atari/old_treeview/hotlist.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright 2010 Ole Loots <ole(a)monochrom.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <ctype.h>
-#include <string.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-
-#include "desktop/browser.h"
-#include "content/content.h"
-#include "content/hlcache.h"
-#include "content/urldb.h"
-#include "utils/nsoption.h"
-#include "desktop/hotlist.h"
-#include "desktop/tree.h"
-#include "desktop/gui.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/utils.h"
-#include "utils/url.h"
-#include "atari/gui.h"
-#include "atari/misc.h"
-#include "atari/treeview.h"
-#include "atari/hotlist.h"
-#include "atari/findfile.h"
-#include "atari/gemtk/gemtk.h"
-#include "atari/res/netsurf.rsh"
-
-extern GRECT desk_area;
-
-struct atari_hotlist hl;
-
-static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
-{
- NSTREEVIEW tv=NULL;
- GRECT tb_area;
-
- if(ev_out->emo_events & MU_MESAG){
- switch (msg[0]) {
-
- case WM_TOOLBAR:
-
- tv = (NSTREEVIEW) gemtk_wm_get_user_data(win);
-
- switch (msg[4]) {
- case TOOLBAR_HOTLIST_CREATE_FOLDER:
- hotlist_add_folder(NULL, false, 0);
- break;
-
- case TOOLBAR_HOTLIST_ADD:
- atari_hotlist_add_page(NULL, NULL);
- break;
-
- case TOOLBAR_HOTLIST_DELETE:
- hotlist_keypress(KEY_DELETE_LEFT);
- gemtk_wm_exec_redraw(tv->window, NULL);
- break;
-
- case TOOLBAR_HOTLIST_EDIT:
- hotlist_edit_selection();
- break;
- }
-
- gemtk_obj_get_tree(TOOLBAR_HOTLIST)[msg[4]].ob_state &= ~OS_SELECTED;
- gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_TOOLBAR, &tb_area);
- evnt_timer(150);
- gemtk_wm_exec_redraw(tv->window, &tb_area);
- break;
-
- case WM_CLOSED:
- atari_hotlist_close();
- break;
-
- default: break;
- }
- }
-
- // TODO: implement selectable objects in toolbar API:
- // ObjcChange( OC_TOOLBAR, win, buff[4], ~SELECTED, OC_MSG );
-}
-
-
-
-void atari_hotlist_init(void)
-{
- if (hl.init == false) {
- if( strcmp(nsoption_charp(hotlist_file), "") == 0 ){
- atari_find_resource( (char*)&hl.path, "hotlist", "hotlist" );
- } else {
- strncpy( (char*)&hl.path, nsoption_charp(hotlist_file), PATH_MAX-1 );
- }
-
- LOG(("Hotlist: %s", (char*)&hl.path ));
-
- if( hl.window == NULL ){
- int flags = ATARI_TREEVIEW_WIDGETS;
- short handle = -1;
- GRECT desk;
- OBJECT * tree = gemtk_obj_get_tree(TOOLBAR_HOTLIST);
- assert( tree );
- hl.open = false;
-
- handle = wind_create(flags, 0, 0, desk_area.g_w, desk_area.g_h);
- hl.window = gemtk_wm_add(handle, GEMTK_WM_FLAG_DEFAULTS, NULL);
- if( hl.window == NULL ) {
- gemtk_msg_box_show(GEMTK_MSG_BOX_ALERT,
- "Failed to allocate Hotlist");
- return;
- }
- wind_set_str(handle, WF_NAME, (char*)messages_get("Hotlist"));
- gemtk_wm_set_toolbar(hl.window, tree, 0, 0);
- gemtk_wm_unlink(hl.window);
- tree_hotlist_path = (const char*)&hl.path;
- hl.tv = atari_treeview_create(
- TREE_HOTLIST,
- hl.window,
- handle_event
- );
- if (hl.tv == NULL) {
- /* handle it properly, clean up previous allocs */
- LOG(("Failed to allocate treeview"));
- return;
- }
-
- } else {
-
- }
- }
- hl.init = true;
-}
-
-
-void atari_hotlist_open(void)
-{
- if( hl.init == false ) {
- return;
- }
-
- if( hl.open == false ) {
-
- GRECT pos;
- pos.g_x = desk_area.g_w - desk_area.g_w / 4;
- pos.g_y = desk_area.g_y;
- pos.g_w = desk_area.g_w / 4;
- pos.g_h = desk_area.g_h;
-
- wind_open_grect(gemtk_wm_get_handle(hl.window), &pos);
- hl.open = true;
- atari_treeview_open( hl.tv );
- } else {
- wind_set(gemtk_wm_get_handle(hl.window), WF_TOP, 1, 0, 0, 0);
- }
-}
-
-void atari_hotlist_close(void)
-{
- wind_close(gemtk_wm_get_handle(hl.window));
- hl.open = false;
- atari_treeview_close(hl.tv);
-}
-
-void atari_hotlist_destroy(void)
-{
-
- if( hl.init == false) {
- return;
- }
- if( hl.window != NULL ) {
- if (hl.open)
- atari_hotlist_close();
- wind_delete(gemtk_wm_get_handle(hl.window));
- gemtk_wm_remove(hl.window);
- hl.window = NULL;
- atari_treeview_destroy(hl.tv);
- hl.init = false;
- }
- LOG(("done"));
-}
-
-void atari_hotlist_redraw(void)
-{
- int i = 01;
- atari_treeview_redraw(hl.tv);
-}
-
-struct node;
-
-void atari_hotlist_add_page( const char * url, const char * title )
-{
- struct node * root;
- struct node * selected = NULL;
- struct node * folder = NULL;
- nsurl *nsurl;
- NSTREEVIEW tv = hl.tv;
- if(hl.tv == NULL )
- return;
-
- atari_hotlist_open();
-
- if (nsurl_create(url, &nsurl) != NSERROR_OK)
- return;
-
- if( hl.tv->click.x >= 0 && hl.tv->click.y >= 0 ){
- hotlist_add_entry( nsurl, title, true, hl.tv->click.y );
- } else {
- hotlist_add_url( nsurl );
- }
- nsurl_unref(nsurl);
-}
diff --git a/atari/old_treeview/hotlist.h b/atari/old_treeview/hotlist.h
deleted file mode 100755
index fc9cba6..0000000
--- a/atari/old_treeview/hotlist.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2010 Ole Loots <ole(a)monochrom.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NS_ATARI_HOTLIST_H
-#define NS_ATARI_HOTLIST_H
-#include <stdbool.h>
-#include "desktop/tree.h"
-#include "atari/gemtk/gemtk.h"
-#include "atari/treeview.h"
-/* The hotlist window, toolbar and treeview data. */
-
-struct atari_hotlist {
- GUIWIN * window;
- NSTREEVIEW tv; /*< The hotlist treeview handle. */
- bool open;
- bool init;
- char path[PATH_MAX];
-};
-
-extern struct atari_hotlist hl;
-
-void atari_hotlist_init( void );
-void atari_hotlist_open( void );
-void atari_hotlist_close( void );
-void atari_hotlist_destroy( void );
-void atari_hotlist_add_page( const char * url, const char * title );
-
-void atari_hotlist_redraw( void );
-
-
-#endif
--
NetSurf Browser
9 years, 12 months
netsurf: branch mono/atari_treeview_rework updated. release/3.0-578-ga19b327
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/a19b32703b989d8eb3c3a...
...commit http://git.netsurf-browser.org/netsurf.git/commit/a19b32703b989d8eb3c3aeb...
...tree http://git.netsurf-browser.org/netsurf.git/tree/a19b32703b989d8eb3c3aeb14...
The branch, mono/atari_treeview_rework has been updated
via a19b32703b989d8eb3c3aeb14dc5bf824d1a5e72 (commit)
from 4426e8a9eaa2fd180e88123f750e74ecb8b77625 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=a19b32703b989d8eb3c...
commit a19b32703b989d8eb3c3aeb14dc5bf824d1a5e72
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Fixed warnings for incomptible pointer type
The API expects to receive core_window as window handle now.
diff --git a/atari/certview.c b/atari/certview.c
index 066a428..bdc2a82 100644
--- a/atari/certview.c
+++ b/atari/certview.c
@@ -74,14 +74,10 @@ static void atari_sslcert_viewer_destroy(struct atari_sslcert_viewer_s * cvwin);
static nserror atari_sslcert_viewer_init_phase2(struct core_window *cw,
struct core_window_callback_table *cb_t)
{
- LOG((""));
-
- struct atari_treeview_window *tv;
struct atari_sslcert_viewer_s *cvwin;
struct sslcert_session_data *ssl_d;
- tv = (struct atari_treeview_window *)cw;
- cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(tv);
+ cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(cw);
assert(cvwin);
@@ -89,18 +85,18 @@ static nserror atari_sslcert_viewer_init_phase2(struct core_window *cw,
assert(ssl_d);
+ LOG((""));
+
return(sslcert_viewer_init(cb_t, cw, ssl_d));
}
static void atari_sslcert_viewer_finish(struct core_window *cw)
{
- struct atari_treeview_window *tv;
struct atari_sslcert_viewer_s *cvwin;
assert(cw);
- tv = (struct atari_treeview_window *)cw;
- cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(tv);
+ cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(cw);
/* This will also free the session data: */
sslcert_viewer_fini(cvwin->ssl_session_data);
@@ -112,13 +108,11 @@ static void atari_sslcert_viewer_draw(struct core_window *cw, int x,
int y, struct rect *clip,
const struct redraw_context *ctx)
{
- struct atari_treeview_window *tv;
struct atari_sslcert_viewer_s *cvwin;
assert(cw);
- tv = (struct atari_treeview_window *)cw;
- cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(tv);
+ cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(cw);
assert(cvwin);
@@ -127,13 +121,11 @@ static void atari_sslcert_viewer_draw(struct core_window *cw, int x,
static void atari_sslcert_viewer_keypress(struct core_window *cw, uint32_t ucs4)
{
- struct atari_treeview_window *tv;
struct atari_sslcert_viewer_s *cvwin;
assert(cw);
- tv = (struct atari_treeview_window *)cw;
- cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(tv);
+ cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(cw);
LOG(("ucs4: %lu\n", ucs4));
sslcert_viewer_keypress(cvwin->ssl_session_data, ucs4);
@@ -143,15 +135,13 @@ static void atari_sslcert_viewer_mouse_action(struct core_window *cw,
browser_mouse_state mouse,
int x, int y)
{
- struct atari_treeview_window *tv;
struct atari_sslcert_viewer_s *cvwin;
assert(cw);
- tv = (struct atari_treeview_window *)cw;
- cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(tv);
+ cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(cw);
- if((mouse & BROWSER_MOUSE_HOVER)){
+ if ((mouse & BROWSER_MOUSE_HOVER)) {
sslcert_viewer_mouse_action(cvwin->ssl_session_data, mouse, x, y);
} else {
sslcert_viewer_mouse_action(cvwin->ssl_session_data, mouse, x, y);
@@ -161,7 +151,7 @@ static void atari_sslcert_viewer_mouse_action(struct core_window *cw,
static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
- struct atari_treeview_window *tv=NULL;
+ struct core_window *tv=NULL;
GRECT tb_area;
GUIWIN * gemtk_win;
struct gui_window * gw;
@@ -178,7 +168,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
case WM_TOOLBAR:
toolbar = gemtk_obj_get_tree(TOOLBAR_SSL_CERT);
LOG(("CERTVIEWER WM_TOOLBAR"));
- tv = (struct atari_treeview_window*) gemtk_wm_get_user_data(win);
+ tv = (struct core_window*) gemtk_wm_get_user_data(win);
assert(tv);
cvwin = (struct atari_sslcert_viewer_s *)
atari_treeview_get_user_data(tv);
@@ -207,7 +197,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
case WM_CLOSED:
// TODO set perrmissions
toolbar = gemtk_obj_get_tree(TOOLBAR_SSL_CERT);
- tv = (struct atari_treeview_window*) gemtk_wm_get_user_data(win);
+ tv = (struct core_window*) gemtk_wm_get_user_data(win);
assert(tv);
cvwin = (struct atari_sslcert_viewer_s *)
atari_treeview_get_user_data(tv);
diff --git a/atari/certview.h b/atari/certview.h
index 642e55e..fc30074 100644
--- a/atari/certview.h
+++ b/atari/certview.h
@@ -33,7 +33,8 @@ struct core_window;
struct atari_sslcert_viewer_s {
GUIWIN * window;
- struct atari_treeview_window *tv;/*< The hotlist treeview handle. */
+ //struct atari_treeview_window *tv;/*< The hotlist treeview handle. */
+ struct core_window *tv;
struct sslcert_session_data *ssl_session_data;
bool init;
};
@@ -45,10 +46,6 @@ struct atari_sslcert_viewer_s {
* The window takes ownership of the session data and free's the memory on exit.
*/
void atari_sslcert_viewer_open(struct sslcert_session_data *ssl_d);
-/*
-void atari_sslcert_viewer_close(void);
-void atari_sslcert_viewer_destroy(void);
-void atari_sslcert_viewer_redraw(void);
-*/
+
#endif // CERTVIEW_H_INCLUDED
diff --git a/atari/cookies.c b/atari/cookies.c
index db45f33..4530a21 100644
--- a/atari/cookies.c
+++ b/atari/cookies.c
@@ -204,11 +204,6 @@ void atari_cookie_manager_open(void)
{
assert(atari_cookie_manager.init);
- if (atari_cookie_manager.init == false) {
- // TODO
- return;
- }
-
if (atari_treeview_is_open(atari_cookie_manager.tv) == false) {
GRECT pos;
diff --git a/atari/cookies.h b/atari/cookies.h
index 1ef03b7..fc95f65 100644
--- a/atari/cookies.h
+++ b/atari/cookies.h
@@ -23,7 +23,8 @@ struct core_window;
struct atari_cookie_manager_s {
GUIWIN * window;
- struct atari_treeview_window * tv;/*< The hotlist treeview handle. */
+ //struct atari_treeview_window * tv;/*< The hotlist treeview handle. */
+ struct core_window *tv;
bool init;
};
diff --git a/atari/history.h b/atari/history.h
index c6b821f..919407c 100644
--- a/atari/history.h
+++ b/atari/history.h
@@ -23,7 +23,8 @@ struct core_window;
struct atari_global_history_s {
GUIWIN * window;
- struct atari_treeview_window * tv;/*< The hotlist treeview handle. */
+ //struct atari_treeview_window * tv;/*< The hotlist treeview handle. */
+ struct core_window *tv;
bool init;
};
diff --git a/atari/hotlist.c b/atari/hotlist.c
index 8db18b0..95b1693 100644
--- a/atari/hotlist.c
+++ b/atari/hotlist.c
@@ -116,21 +116,30 @@ static void atari_hotlist_mouse_action(struct core_window *cw,
static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
struct atari_treeview_window *tv=NULL;
+ struct core_window *cw;
GRECT tb_area;
GUIWIN * gemtk_win;
struct gui_window * gw;
char *cur_url = NULL;
char *cur_title = NULL;
+ OBJECT *toolbar;
LOG((""));
+ tv = (struct atari_treeview_window*) gemtk_wm_get_user_data(win);
+ cw = (struct core_window *)tv;
+
if(ev_out->emo_events & MU_MESAG){
switch (msg[0]) {
case WM_TOOLBAR:
LOG(("WM_TOOLBAR"));
- tv = (struct atari_treeview_window*) gemtk_wm_get_user_data(win);
+
+ toolbar = gemtk_obj_get_tree(TOOLBAR_HOTLIST);
+
+ assert(toolbar);
assert(tv);
+
switch (msg[4]) {
case TOOLBAR_HOTLIST_CREATE_FOLDER:
hotlist_add_folder(NULL, 0, 0);
@@ -161,10 +170,10 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
break;
}
- gemtk_win = atari_treeview_get_gemtk_window(tv);
+ gemtk_win = atari_treeview_get_gemtk_window(cw);
assert(gemtk_win);
- gemtk_obj_get_tree(TOOLBAR_HOTLIST)[msg[4]].ob_state &= ~OS_SELECTED;
- atari_treeview_get_grect(tv, TREEVIEW_AREA_TOOLBAR, &tb_area);
+ toolbar[msg[4]].ob_state &= ~OS_SELECTED;
+ atari_treeview_get_grect(cw, TREEVIEW_AREA_TOOLBAR, &tb_area);
evnt_timer(150);
gemtk_wm_exec_redraw(gemtk_win, &tb_area);
break;
@@ -286,8 +295,8 @@ void atari_hotlist_add_page( const char * url, const char * title )
struct node * selected = NULL;
struct node * folder = NULL;
nsurl *nsurl;
- ATARI_TREEVIEW_PTR tv = hl.tv;
- if(hl.tv == NULL )
+
+ if(hl.tv == NULL)
return;
atari_hotlist_open();
diff --git a/atari/hotlist.h b/atari/hotlist.h
index 2bcda5f..d3ef022 100644
--- a/atari/hotlist.h
+++ b/atari/hotlist.h
@@ -26,7 +26,8 @@
struct atari_hotlist {
GUIWIN * window;
- ATARI_TREEVIEW_PTR tv;/*< The hotlist treeview handle. */
+ //ATARI_TREEVIEW_PTR tv;/*< The hotlist treeview handle. */
+ struct core_window *tv;
bool init;
char path[PATH_MAX];
};
diff --git a/atari/treeview.c b/atari/treeview.c
index bd82177..b4aafa9 100644
--- a/atari/treeview.c
+++ b/atari/treeview.c
@@ -82,12 +82,12 @@ struct atari_treeview_window {
static struct atari_treeview_window * treeviews_open;
/* native GUI event handlers: */
-static void on_mbutton_event(struct atari_treeview_window *tvw,
- EVMULT_OUT *ev_out, short msg[8]);
-static void on_keybd_event(struct atari_treeview_window *tvw,
- EVMULT_OUT *ev_out, short msg[8]);
-static void on_redraw_event(struct atari_treeview_window *tvw,
- EVMULT_OUT *ev_out, short msg[8]);
+static void on_mbutton_event(struct core_window *cw, EVMULT_OUT *ev_out,
+ short msg[8]);
+static void on_keybd_event(struct core_window *cw, EVMULT_OUT *ev_out,
+ short msg[8]);
+static void on_redraw_event(struct core_window *cw, EVMULT_OUT *ev_out,
+ short msg[8]);
/* static utils: */
static void atari_treeview_dump_info(struct atari_treeview_window *tv, char *s);
@@ -99,8 +99,8 @@ static void atari_treeview_dump_info(struct atari_treeview_window *tv, char *s);
static void atari_treeview_redraw_grect_request(struct core_window *cw,
GRECT *area)
{
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
if (cw != NULL) {
- ATARI_TREEVIEW_PTR tv = (ATARI_TREEVIEW_PTR) cw;
if( tv->redraw == false ){
tv->redraw = true;
tv->rdw_area.g_x = area->g_x;
@@ -123,11 +123,11 @@ static void atari_treeview_redraw_grect_request(struct core_window *cw,
}
-void atari_treeview_get_grect(ATARI_TREEVIEW_PTR tptr, enum treeview_area_e mode,
+void atari_treeview_get_grect(struct core_window *cw, enum treeview_area_e mode,
GRECT *dest)
{
- struct atari_treeview_window * tv = tptr;
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
if (mode == TREEVIEW_AREA_CONTENT) {
gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, dest);
@@ -137,8 +137,9 @@ void atari_treeview_get_grect(ATARI_TREEVIEW_PTR tptr, enum treeview_area_e mode
}
}
-GUIWIN * atari_treeview_get_gemtk_window(struct atari_treeview_window *tv)
+GUIWIN * atari_treeview_get_gemtk_window(struct core_window *cw)
{
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
return(tv->window);
}
@@ -147,15 +148,17 @@ static void atari_treeview_dump_info(struct atari_treeview_window *tv,
{
printf("Treeview Dump (%s)\n", title);
printf("=================================\n");
- gemtk_wm_dump_window_info(atari_treeview_get_gemtk_window(tv));
+ gemtk_wm_dump_window_info(atari_treeview_get_gemtk_window((struct core_window *)tv));
GEMTK_DBG_GRECT("Redraw Area: \n", &tv->rdw_area)
dbg_grect("Redraw Area2: \n", &tv->rdw_area);
printf("Extent: x: %d, y: %d\n", tv->extent, tv->extent);
}
-void atari_treeview_redraw(struct atari_treeview_window *tv)
+void atari_treeview_redraw(struct core_window *cw)
{
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
+
if (tv != NULL && tv->is_open) {
if( tv->redraw && ((plot_get_flags() & PLOT_FLAG_OFFSCREEN) == 0) ) {
@@ -215,7 +218,6 @@ void atari_treeview_redraw(struct atari_treeview_window *tv)
todo[1] = 0;
}
- // TODO: get slider values
if (rc_intersect((GRECT *)&tv->rdw_area,(GRECT *)&todo)) {
struct rect clip;
@@ -224,7 +226,7 @@ void atari_treeview_redraw(struct atari_treeview_window *tv)
clip.x1 = clip.x0 + todo[2]+(slid->x_pos*slid->x_unit_px);
clip.y1 = clip.y0 + todo[3]+(slid->y_pos*slid->y_unit_px);
- tv->io->draw(tv, -(slid->x_pos*slid->x_unit_px),
+ tv->io->draw(cw, -(slid->x_pos*slid->x_unit_px),
-(slid->y_pos*slid->y_unit_px),
&clip, &ctx);
}
@@ -388,14 +390,16 @@ void atari_treeview_redraw(struct atari_treeview_window *tv)
*/
static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
- ATARI_TREEVIEW_PTR tv = (ATARI_TREEVIEW_PTR) gemtk_wm_get_user_data(win);
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)
+ gemtk_wm_get_user_data(win);
+ struct core_window *cw = (struct core_window *)tv;
if( (ev_out->emo_events & MU_MESAG) != 0 ) {
// handle message
switch (msg[0]) {
case WM_REDRAW:
- on_redraw_event(tv, ev_out, msg);
+ on_redraw_event(cw, ev_out, msg);
break;
default:
@@ -403,12 +407,12 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
}
}
if( (ev_out->emo_events & MU_KEYBD) != 0 ) {
- on_keybd_event(tv, ev_out, msg);
+ on_keybd_event(cw, ev_out, msg);
}
if( (ev_out->emo_events & MU_BUTTON) != 0 ) {
LOG(("Treeview click at: %d,%d\n", ev_out->emo_mouse.p_x,
ev_out->emo_mouse.p_y));
- on_mbutton_event(tv, ev_out, msg);
+ on_mbutton_event(cw, ev_out, msg);
}
if(tv != NULL && tv->io->gemtk_user_func != NULL){
@@ -419,7 +423,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
}
-static void __CDECL on_keybd_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out,
+static void __CDECL on_keybd_event(struct core_window *cw, EVMULT_OUT *ev_out,
short msg[8])
{
bool r=false;
@@ -430,7 +434,7 @@ static void __CDECL on_keybd_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out,
unsigned short nkc = 0;
unsigned short nks = 0;
unsigned char ascii;
- struct atari_treeview_window * tv = tptr;
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
kstate = ev_out->emo_kmeta;
kcode = ev_out->emo_kreturn;
@@ -440,21 +444,20 @@ static void __CDECL on_keybd_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out,
if (ik == 0) {
if (ascii >= 9) {
- tv->io->keypress(tv, ucs4);
- //r = tree_keypress(tv->tree, ucs4);
+ tv->io->keypress(cw, ucs4);
}
} else {
- tv->io->keypress(tv, ik);
+ tv->io->keypress(cw, ik);
}
}
-static void __CDECL on_redraw_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out,
+static void __CDECL on_redraw_event(struct core_window *cw, EVMULT_OUT *ev_out,
short msg[8])
{
GRECT work, clip;
struct gemtk_wm_scroll_info_s *slid;
- struct atari_treeview_window * tv = tptr;
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
if (tv == NULL)
return;
@@ -462,7 +465,7 @@ static void __CDECL on_redraw_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out,
gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &work);
//dbg_grect("treeview work: ", &work);
- atari_treeview_get_grect(tv, TREEVIEW_AREA_CONTENT, &work);
+ atari_treeview_get_grect(cw, TREEVIEW_AREA_CONTENT, &work);
//dbg_grect("treeview work: ", &work);
slid = gemtk_wm_get_scroll_info(tv->window);
@@ -499,14 +502,14 @@ static void __CDECL on_redraw_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out,
//dbg_grect("treeview on_redraw_event ", &rdrw_area);
- atari_treeview_redraw_grect_request(tptr, &rdrw_area);
+ atari_treeview_redraw_grect_request(cw, &rdrw_area);
}
}
-static void __CDECL on_mbutton_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out,
+static void __CDECL on_mbutton_event(struct core_window *cw, EVMULT_OUT *ev_out,
short msg[8])
{
- struct atari_treeview_window * tv = tptr;
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
struct gemtk_wm_scroll_info_s *slid;
GRECT work;
short mx, my;
@@ -534,7 +537,7 @@ static void __CDECL on_mbutton_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out
&& my < work.g_y + work.g_h )
{
if (ev_out->emo_mclicks == 2) {
- tv->io->mouse_action(tv,
+ tv->io->mouse_action(cw,
BROWSER_MOUSE_CLICK_1|BROWSER_MOUSE_DOUBLE_CLICK,
origin_rel_x, origin_rel_y);
return;
@@ -547,7 +550,7 @@ static void __CDECL on_mbutton_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out
if(ev_out->emo_mclicks == 2 ) {
bms = BROWSER_MOUSE_DOUBLE_CLICK;
}
- tv->io->mouse_action(tv, bms, origin_rel_x, origin_rel_y);
+ tv->io->mouse_action(cw, bms, origin_rel_x, origin_rel_y);
} else {
/* button still pressed */
short prev_x = origin_rel_x;
@@ -561,14 +564,14 @@ static void __CDECL on_mbutton_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out
tv->startdrag.x = origin_rel_x;
tv->startdrag.y = origin_rel_y;
/* First, report mouse press, to trigger entry selection */
- tv->io->mouse_action(tv, BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_PRESS_1, cur_rel_x,
+ tv->io->mouse_action(cw, BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_PRESS_1, cur_rel_x,
cur_rel_y);
- atari_treeview_redraw(tv);
- tv->io->mouse_action(tv, BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_ON,
+ atari_treeview_redraw(cw);
+ tv->io->mouse_action(cw, BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_ON,
cur_rel_x, cur_rel_y);
do{
if (abs(prev_x-cur_rel_x) > 5 || abs(prev_y-cur_rel_y) > 5) {
- tv->io->mouse_action(tv,
+ tv->io->mouse_action(cw,
BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON,
cur_rel_x, cur_rel_y);
prev_x = cur_rel_x;
@@ -578,7 +581,7 @@ static void __CDECL on_mbutton_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out
if (tv->redraw) {
// TODO: maybe GUI poll would fit better here?
// ... is gui_poll re-entrance save?
- atari_treeview_redraw(tv);
+ atari_treeview_redraw(cw);
}
/* sample mouse button state: */
@@ -588,50 +591,50 @@ static void __CDECL on_mbutton_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out
} while( mbut & 1 );
/* End drag: */
- tv->io->mouse_action(tv, BROWSER_MOUSE_HOVER, cur_rel_x, cur_rel_y);
+ tv->io->mouse_action(cw, BROWSER_MOUSE_HOVER, cur_rel_x, cur_rel_y);
gem_set_cursor(&gem_cursors.arrow);
}
}
}
-struct atari_treeview_window *
+struct core_window *
atari_treeview_create(GUIWIN *win, struct atari_treeview_callbacks * callbacks,
void * user_data, uint32_t flags)
{
/* allocate the core_window struct: */
- struct atari_treeview_window * cw;
+ struct atari_treeview_window * tv;
struct gemtk_wm_scroll_info_s *slid;
- cw = calloc(1, sizeof(struct atari_treeview_window));
- if (cw == NULL) {
+ tv = calloc(1, sizeof(struct atari_treeview_window));
+ if (tv == NULL) {
LOG(("calloc failed"));
warn_user(messages_get_errorcode(NSERROR_NOMEM), 0);
return NULL;
}
/* Store the window ref inside the new treeview: */
- cw->window = win;
- cw->io = callbacks;
- cw->user_data = user_data;
+ tv->window = win;
+ tv->io = callbacks;
+ tv->user_data = user_data;
// Setup gemtk event handler function:
gemtk_wm_set_event_handler(win, handle_event);
// bind window user data to treeview ref:
- gemtk_wm_set_user_data(win, (void*)cw);
+ gemtk_wm_set_user_data(win, (void*)tv);
// Get acces to the gemtk scroll info struct:
- slid = gemtk_wm_get_scroll_info(cw->window);
+ slid = gemtk_wm_get_scroll_info(tv->window);
// Setup line and column height/width of the window,
// each scroll takes the configured steps:
slid->y_unit_px = 16;
slid->x_unit_px = 16;
- assert(cw->io);
- assert(cw->io->init_phase2);
+ assert(tv->io);
+ assert(tv->io->init_phase2);
/* Now that the window is configured for treeview content, */
/* call init_phase2 which must create the treeview */
@@ -639,34 +642,37 @@ atari_treeview_create(GUIWIN *win, struct atari_treeview_callbacks * callbacks,
/* event handlers of the treeview: */
/* It would be more simple to not pass around the callbacks */
/* but the treeview constructor requires them for initialization... */
- nserror err = cw->io->init_phase2(cw, &cw_t);
+ nserror err = tv->io->init_phase2((struct core_window *)tv, &cw_t);
if (err != NSERROR_OK) {
- free(cw);
- cw = NULL;
+ free(tv);
+ tv = NULL;
}
- return(cw);
+ return((struct core_window *)tv);
}
-void atari_treeview_delete(struct atari_treeview_window * cw)
+void atari_treeview_delete(struct core_window * cw)
{
- assert(cw);
- assert(cw->io->finish);
+ struct atari_treeview_window *tv = (struct atari_treeview_window*)cw;
+
+ assert(tv);
+ assert(tv->io->finish);
- cw->io->finish(cw);
+ tv->io->finish(cw);
- free(cw);
+ free(tv);
}
-void atari_treeview_open(struct atari_treeview_window *cw, GRECT *pos)
+void atari_treeview_open(struct core_window *cw, GRECT *pos)
{
- if (cw->window != NULL && cw->is_open == false) {
- cw->is_open = true;
- wind_open_grect(gemtk_wm_get_handle(cw->window), pos);
- gemtk_wm_link(cw->window);
+ struct atari_treeview_window *tv = (struct atari_treeview_window*)cw;
+ if (tv->window != NULL && tv->is_open == false) {
+ tv->is_open = true;
+ wind_open_grect(gemtk_wm_get_handle(tv->window), pos);
+ gemtk_wm_link(tv->window);
if (treeviews_open == NULL) {
- treeviews_open = cw;
+ treeviews_open = tv;
treeviews_open->next_open = NULL;
treeviews_open->prev_open = NULL;
} else {
@@ -675,44 +681,48 @@ void atari_treeview_open(struct atari_treeview_window *cw, GRECT *pos)
while(tmp->next_open != NULL){
tmp = tmp->next_open;
}
- tmp->next_open = cw;
- cw->prev_open = tmp;
- cw->next_open = NULL;
+ tmp->next_open = tv;
+ tv->prev_open = tmp;
+ tv->next_open = NULL;
}
}
}
-bool atari_treeview_is_open(struct atari_treeview_window *cw)
+bool atari_treeview_is_open(struct core_window *cw)
{
- return(cw->is_open);
+ struct atari_treeview_window *tv = (struct atari_treeview_window*)cw;
+ return(tv->is_open);
}
-void atari_treeview_set_user_data(struct atari_treeview_window * tv,
+void atari_treeview_set_user_data(struct core_window * cw,
void *user_data_ptr)
{
+ struct atari_treeview_window *tv = (struct atari_treeview_window*)cw;
tv->user_data = user_data_ptr;
}
-void * atari_treeview_get_user_data(struct atari_treeview_window * tv)
+void * atari_treeview_get_user_data(struct core_window * cw)
{
+ struct atari_treeview_window *tv = (struct atari_treeview_window*)cw;
return(tv->user_data);
}
-void atari_treeview_close(struct atari_treeview_window *cw)
+void atari_treeview_close(struct core_window *cw)
{
- if (cw->window != NULL) {
- cw->is_open = false;
- wind_close(gemtk_wm_get_handle(cw->window));
- gemtk_wm_unlink(cw->window);
+ struct atari_treeview_window *tv = (struct atari_treeview_window*)cw;
+ if (tv->window != NULL) {
+ tv->is_open = false;
+ wind_close(gemtk_wm_get_handle(tv->window));
+ gemtk_wm_unlink(tv->window);
/* unlink the window: */
struct atari_treeview_window *tmp = treeviews_open;
- if (cw->prev_open != NULL) {
- cw->prev_open->next_open = cw->next_open;
+ if (tv->prev_open != NULL) {
+ tv->prev_open->next_open = tv->next_open;
} else {
- treeviews_open = cw->next_open;
+ treeviews_open = tv->next_open;
}
- if (cw->next_open != NULL) {
- cw->next_open->prev_open = cw->prev_open;
+ if (tv->next_open != NULL) {
+ tv->next_open->prev_open = tv->prev_open;
}
}
}
@@ -732,7 +742,7 @@ void atari_treeview_redraw_request(struct core_window *cw, const struct rect *r)
{
GRECT area;
struct gemtk_wm_scroll_info_s * slid;
- struct atari_treeview_window * tv = (cw);
+ struct atari_treeview_window * tv = (struct atari_treeview_window *)cw;
RECT_TO_GRECT(r, &area)
@@ -771,7 +781,7 @@ void atari_treeview_update_size(struct core_window *cw, int width, int height)
slid = gemtk_wm_get_scroll_info(tv->window);
/* recalculate and refresh sliders: */
- atari_treeview_get_grect(tv, TREEVIEW_AREA_CONTENT, &area);
+ atari_treeview_get_grect(cw, TREEVIEW_AREA_CONTENT, &area);
if (width > -1) {
slid->x_units = (width/slid->x_unit_px);
} else {
@@ -821,7 +831,7 @@ void atari_treeview_get_window_dimensions(struct core_window *cw,
if (cw != NULL && (width != NULL || height != NULL)) {
GRECT work;
struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
- atari_treeview_get_grect(tv, TREEVIEW_AREA_CONTENT, &work);
+ atari_treeview_get_grect(cw, TREEVIEW_AREA_CONTENT, &work);
*width = work.g_w;
*height = work.g_h;
}
@@ -850,7 +860,7 @@ void atari_treeview_flush_redraws(void)
while(tmp){
assert(tmp->is_open);
if(tmp->redraw){
- atari_treeview_redraw(tmp);
+ atari_treeview_redraw((struct core_window *)tmp);
}
tmp = tmp->next_open;
}
diff --git a/atari/treeview.h b/atari/treeview.h
index d9defcc..fb4e659 100644
--- a/atari/treeview.h
+++ b/atari/treeview.h
@@ -60,20 +60,20 @@ struct atari_treeview_callbacks {
gemtk_wm_event_handler_f gemtk_user_func;
};
-struct atari_treeview_window * atari_treeview_create(GUIWIN *win,
+struct core_window *atari_treeview_create(GUIWIN *win,
struct atari_treeview_callbacks * callbacks,
void * user_data, uint32_t flags);
-void atari_treeview_delete(struct atari_treeview_window * cw);
-void atari_treeview_open(struct atari_treeview_window * cw, GRECT *pos);
-bool atari_treeview_is_open(struct atari_treeview_window *cw);
-void atari_treeview_close(struct atari_treeview_window * cw);
-GUIWIN * atari_treeview_get_gemtk_window(struct atari_treeview_window *tv);
-void atari_treeview_get_grect(ATARI_TREEVIEW_PTR tptr, enum treeview_area_e mode,
+void atari_treeview_delete(struct core_window *cw);
+void atari_treeview_open(struct core_window *cw, GRECT *pos);
+bool atari_treeview_is_open(struct core_window *cw);
+void atari_treeview_close(struct core_window *cw);
+GUIWIN * atari_treeview_get_gemtk_window(struct core_window *cw);
+void atari_treeview_get_grect(struct core_window *cw, enum treeview_area_e mode,
GRECT *dest);
-void atari_treeview_redraw(struct atari_treeview_window *tv);
-void atari_treeview_set_user_data(struct atari_treeview_window * tv,
+void atari_treeview_redraw(struct core_window *cw);
+void atari_treeview_set_user_data(struct core_window *cw,
void *user_data_ptr);
-void *atari_treeview_get_user_data(struct atari_treeview_window * tv);
+void *atari_treeview_get_user_data(struct core_window *cw);
void atari_treeview_flush_redraws(void);
#endif //NSATARI_TREEVIEW_H
-----------------------------------------------------------------------
Summary of changes:
atari/certview.c | 32 +++------
atari/certview.h | 9 +--
atari/cookies.c | 5 --
atari/cookies.h | 3 +-
atari/history.h | 3 +-
atari/hotlist.c | 21 +++++--
atari/hotlist.h | 3 +-
atari/treeview.c | 178 ++++++++++++++++++++++++++++-------------------------
atari/treeview.h | 20 +++---
9 files changed, 139 insertions(+), 135 deletions(-)
diff --git a/atari/certview.c b/atari/certview.c
index 066a428..bdc2a82 100644
--- a/atari/certview.c
+++ b/atari/certview.c
@@ -74,14 +74,10 @@ static void atari_sslcert_viewer_destroy(struct atari_sslcert_viewer_s * cvwin);
static nserror atari_sslcert_viewer_init_phase2(struct core_window *cw,
struct core_window_callback_table *cb_t)
{
- LOG((""));
-
- struct atari_treeview_window *tv;
struct atari_sslcert_viewer_s *cvwin;
struct sslcert_session_data *ssl_d;
- tv = (struct atari_treeview_window *)cw;
- cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(tv);
+ cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(cw);
assert(cvwin);
@@ -89,18 +85,18 @@ static nserror atari_sslcert_viewer_init_phase2(struct core_window *cw,
assert(ssl_d);
+ LOG((""));
+
return(sslcert_viewer_init(cb_t, cw, ssl_d));
}
static void atari_sslcert_viewer_finish(struct core_window *cw)
{
- struct atari_treeview_window *tv;
struct atari_sslcert_viewer_s *cvwin;
assert(cw);
- tv = (struct atari_treeview_window *)cw;
- cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(tv);
+ cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(cw);
/* This will also free the session data: */
sslcert_viewer_fini(cvwin->ssl_session_data);
@@ -112,13 +108,11 @@ static void atari_sslcert_viewer_draw(struct core_window *cw, int x,
int y, struct rect *clip,
const struct redraw_context *ctx)
{
- struct atari_treeview_window *tv;
struct atari_sslcert_viewer_s *cvwin;
assert(cw);
- tv = (struct atari_treeview_window *)cw;
- cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(tv);
+ cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(cw);
assert(cvwin);
@@ -127,13 +121,11 @@ static void atari_sslcert_viewer_draw(struct core_window *cw, int x,
static void atari_sslcert_viewer_keypress(struct core_window *cw, uint32_t ucs4)
{
- struct atari_treeview_window *tv;
struct atari_sslcert_viewer_s *cvwin;
assert(cw);
- tv = (struct atari_treeview_window *)cw;
- cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(tv);
+ cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(cw);
LOG(("ucs4: %lu\n", ucs4));
sslcert_viewer_keypress(cvwin->ssl_session_data, ucs4);
@@ -143,15 +135,13 @@ static void atari_sslcert_viewer_mouse_action(struct core_window *cw,
browser_mouse_state mouse,
int x, int y)
{
- struct atari_treeview_window *tv;
struct atari_sslcert_viewer_s *cvwin;
assert(cw);
- tv = (struct atari_treeview_window *)cw;
- cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(tv);
+ cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(cw);
- if((mouse & BROWSER_MOUSE_HOVER)){
+ if ((mouse & BROWSER_MOUSE_HOVER)) {
sslcert_viewer_mouse_action(cvwin->ssl_session_data, mouse, x, y);
} else {
sslcert_viewer_mouse_action(cvwin->ssl_session_data, mouse, x, y);
@@ -161,7 +151,7 @@ static void atari_sslcert_viewer_mouse_action(struct core_window *cw,
static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
- struct atari_treeview_window *tv=NULL;
+ struct core_window *tv=NULL;
GRECT tb_area;
GUIWIN * gemtk_win;
struct gui_window * gw;
@@ -178,7 +168,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
case WM_TOOLBAR:
toolbar = gemtk_obj_get_tree(TOOLBAR_SSL_CERT);
LOG(("CERTVIEWER WM_TOOLBAR"));
- tv = (struct atari_treeview_window*) gemtk_wm_get_user_data(win);
+ tv = (struct core_window*) gemtk_wm_get_user_data(win);
assert(tv);
cvwin = (struct atari_sslcert_viewer_s *)
atari_treeview_get_user_data(tv);
@@ -207,7 +197,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
case WM_CLOSED:
// TODO set perrmissions
toolbar = gemtk_obj_get_tree(TOOLBAR_SSL_CERT);
- tv = (struct atari_treeview_window*) gemtk_wm_get_user_data(win);
+ tv = (struct core_window*) gemtk_wm_get_user_data(win);
assert(tv);
cvwin = (struct atari_sslcert_viewer_s *)
atari_treeview_get_user_data(tv);
diff --git a/atari/certview.h b/atari/certview.h
index 642e55e..fc30074 100644
--- a/atari/certview.h
+++ b/atari/certview.h
@@ -33,7 +33,8 @@ struct core_window;
struct atari_sslcert_viewer_s {
GUIWIN * window;
- struct atari_treeview_window *tv;/*< The hotlist treeview handle. */
+ //struct atari_treeview_window *tv;/*< The hotlist treeview handle. */
+ struct core_window *tv;
struct sslcert_session_data *ssl_session_data;
bool init;
};
@@ -45,10 +46,6 @@ struct atari_sslcert_viewer_s {
* The window takes ownership of the session data and free's the memory on exit.
*/
void atari_sslcert_viewer_open(struct sslcert_session_data *ssl_d);
-/*
-void atari_sslcert_viewer_close(void);
-void atari_sslcert_viewer_destroy(void);
-void atari_sslcert_viewer_redraw(void);
-*/
+
#endif // CERTVIEW_H_INCLUDED
diff --git a/atari/cookies.c b/atari/cookies.c
index db45f33..4530a21 100644
--- a/atari/cookies.c
+++ b/atari/cookies.c
@@ -204,11 +204,6 @@ void atari_cookie_manager_open(void)
{
assert(atari_cookie_manager.init);
- if (atari_cookie_manager.init == false) {
- // TODO
- return;
- }
-
if (atari_treeview_is_open(atari_cookie_manager.tv) == false) {
GRECT pos;
diff --git a/atari/cookies.h b/atari/cookies.h
index 1ef03b7..fc95f65 100644
--- a/atari/cookies.h
+++ b/atari/cookies.h
@@ -23,7 +23,8 @@ struct core_window;
struct atari_cookie_manager_s {
GUIWIN * window;
- struct atari_treeview_window * tv;/*< The hotlist treeview handle. */
+ //struct atari_treeview_window * tv;/*< The hotlist treeview handle. */
+ struct core_window *tv;
bool init;
};
diff --git a/atari/history.h b/atari/history.h
index c6b821f..919407c 100644
--- a/atari/history.h
+++ b/atari/history.h
@@ -23,7 +23,8 @@ struct core_window;
struct atari_global_history_s {
GUIWIN * window;
- struct atari_treeview_window * tv;/*< The hotlist treeview handle. */
+ //struct atari_treeview_window * tv;/*< The hotlist treeview handle. */
+ struct core_window *tv;
bool init;
};
diff --git a/atari/hotlist.c b/atari/hotlist.c
index 8db18b0..95b1693 100644
--- a/atari/hotlist.c
+++ b/atari/hotlist.c
@@ -116,21 +116,30 @@ static void atari_hotlist_mouse_action(struct core_window *cw,
static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
struct atari_treeview_window *tv=NULL;
+ struct core_window *cw;
GRECT tb_area;
GUIWIN * gemtk_win;
struct gui_window * gw;
char *cur_url = NULL;
char *cur_title = NULL;
+ OBJECT *toolbar;
LOG((""));
+ tv = (struct atari_treeview_window*) gemtk_wm_get_user_data(win);
+ cw = (struct core_window *)tv;
+
if(ev_out->emo_events & MU_MESAG){
switch (msg[0]) {
case WM_TOOLBAR:
LOG(("WM_TOOLBAR"));
- tv = (struct atari_treeview_window*) gemtk_wm_get_user_data(win);
+
+ toolbar = gemtk_obj_get_tree(TOOLBAR_HOTLIST);
+
+ assert(toolbar);
assert(tv);
+
switch (msg[4]) {
case TOOLBAR_HOTLIST_CREATE_FOLDER:
hotlist_add_folder(NULL, 0, 0);
@@ -161,10 +170,10 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
break;
}
- gemtk_win = atari_treeview_get_gemtk_window(tv);
+ gemtk_win = atari_treeview_get_gemtk_window(cw);
assert(gemtk_win);
- gemtk_obj_get_tree(TOOLBAR_HOTLIST)[msg[4]].ob_state &= ~OS_SELECTED;
- atari_treeview_get_grect(tv, TREEVIEW_AREA_TOOLBAR, &tb_area);
+ toolbar[msg[4]].ob_state &= ~OS_SELECTED;
+ atari_treeview_get_grect(cw, TREEVIEW_AREA_TOOLBAR, &tb_area);
evnt_timer(150);
gemtk_wm_exec_redraw(gemtk_win, &tb_area);
break;
@@ -286,8 +295,8 @@ void atari_hotlist_add_page( const char * url, const char * title )
struct node * selected = NULL;
struct node * folder = NULL;
nsurl *nsurl;
- ATARI_TREEVIEW_PTR tv = hl.tv;
- if(hl.tv == NULL )
+
+ if(hl.tv == NULL)
return;
atari_hotlist_open();
diff --git a/atari/hotlist.h b/atari/hotlist.h
index 2bcda5f..d3ef022 100644
--- a/atari/hotlist.h
+++ b/atari/hotlist.h
@@ -26,7 +26,8 @@
struct atari_hotlist {
GUIWIN * window;
- ATARI_TREEVIEW_PTR tv;/*< The hotlist treeview handle. */
+ //ATARI_TREEVIEW_PTR tv;/*< The hotlist treeview handle. */
+ struct core_window *tv;
bool init;
char path[PATH_MAX];
};
diff --git a/atari/treeview.c b/atari/treeview.c
index bd82177..b4aafa9 100644
--- a/atari/treeview.c
+++ b/atari/treeview.c
@@ -82,12 +82,12 @@ struct atari_treeview_window {
static struct atari_treeview_window * treeviews_open;
/* native GUI event handlers: */
-static void on_mbutton_event(struct atari_treeview_window *tvw,
- EVMULT_OUT *ev_out, short msg[8]);
-static void on_keybd_event(struct atari_treeview_window *tvw,
- EVMULT_OUT *ev_out, short msg[8]);
-static void on_redraw_event(struct atari_treeview_window *tvw,
- EVMULT_OUT *ev_out, short msg[8]);
+static void on_mbutton_event(struct core_window *cw, EVMULT_OUT *ev_out,
+ short msg[8]);
+static void on_keybd_event(struct core_window *cw, EVMULT_OUT *ev_out,
+ short msg[8]);
+static void on_redraw_event(struct core_window *cw, EVMULT_OUT *ev_out,
+ short msg[8]);
/* static utils: */
static void atari_treeview_dump_info(struct atari_treeview_window *tv, char *s);
@@ -99,8 +99,8 @@ static void atari_treeview_dump_info(struct atari_treeview_window *tv, char *s);
static void atari_treeview_redraw_grect_request(struct core_window *cw,
GRECT *area)
{
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
if (cw != NULL) {
- ATARI_TREEVIEW_PTR tv = (ATARI_TREEVIEW_PTR) cw;
if( tv->redraw == false ){
tv->redraw = true;
tv->rdw_area.g_x = area->g_x;
@@ -123,11 +123,11 @@ static void atari_treeview_redraw_grect_request(struct core_window *cw,
}
-void atari_treeview_get_grect(ATARI_TREEVIEW_PTR tptr, enum treeview_area_e mode,
+void atari_treeview_get_grect(struct core_window *cw, enum treeview_area_e mode,
GRECT *dest)
{
- struct atari_treeview_window * tv = tptr;
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
if (mode == TREEVIEW_AREA_CONTENT) {
gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, dest);
@@ -137,8 +137,9 @@ void atari_treeview_get_grect(ATARI_TREEVIEW_PTR tptr, enum treeview_area_e mode
}
}
-GUIWIN * atari_treeview_get_gemtk_window(struct atari_treeview_window *tv)
+GUIWIN * atari_treeview_get_gemtk_window(struct core_window *cw)
{
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
return(tv->window);
}
@@ -147,15 +148,17 @@ static void atari_treeview_dump_info(struct atari_treeview_window *tv,
{
printf("Treeview Dump (%s)\n", title);
printf("=================================\n");
- gemtk_wm_dump_window_info(atari_treeview_get_gemtk_window(tv));
+ gemtk_wm_dump_window_info(atari_treeview_get_gemtk_window((struct core_window *)tv));
GEMTK_DBG_GRECT("Redraw Area: \n", &tv->rdw_area)
dbg_grect("Redraw Area2: \n", &tv->rdw_area);
printf("Extent: x: %d, y: %d\n", tv->extent, tv->extent);
}
-void atari_treeview_redraw(struct atari_treeview_window *tv)
+void atari_treeview_redraw(struct core_window *cw)
{
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
+
if (tv != NULL && tv->is_open) {
if( tv->redraw && ((plot_get_flags() & PLOT_FLAG_OFFSCREEN) == 0) ) {
@@ -215,7 +218,6 @@ void atari_treeview_redraw(struct atari_treeview_window *tv)
todo[1] = 0;
}
- // TODO: get slider values
if (rc_intersect((GRECT *)&tv->rdw_area,(GRECT *)&todo)) {
struct rect clip;
@@ -224,7 +226,7 @@ void atari_treeview_redraw(struct atari_treeview_window *tv)
clip.x1 = clip.x0 + todo[2]+(slid->x_pos*slid->x_unit_px);
clip.y1 = clip.y0 + todo[3]+(slid->y_pos*slid->y_unit_px);
- tv->io->draw(tv, -(slid->x_pos*slid->x_unit_px),
+ tv->io->draw(cw, -(slid->x_pos*slid->x_unit_px),
-(slid->y_pos*slid->y_unit_px),
&clip, &ctx);
}
@@ -388,14 +390,16 @@ void atari_treeview_redraw(struct atari_treeview_window *tv)
*/
static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
- ATARI_TREEVIEW_PTR tv = (ATARI_TREEVIEW_PTR) gemtk_wm_get_user_data(win);
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)
+ gemtk_wm_get_user_data(win);
+ struct core_window *cw = (struct core_window *)tv;
if( (ev_out->emo_events & MU_MESAG) != 0 ) {
// handle message
switch (msg[0]) {
case WM_REDRAW:
- on_redraw_event(tv, ev_out, msg);
+ on_redraw_event(cw, ev_out, msg);
break;
default:
@@ -403,12 +407,12 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
}
}
if( (ev_out->emo_events & MU_KEYBD) != 0 ) {
- on_keybd_event(tv, ev_out, msg);
+ on_keybd_event(cw, ev_out, msg);
}
if( (ev_out->emo_events & MU_BUTTON) != 0 ) {
LOG(("Treeview click at: %d,%d\n", ev_out->emo_mouse.p_x,
ev_out->emo_mouse.p_y));
- on_mbutton_event(tv, ev_out, msg);
+ on_mbutton_event(cw, ev_out, msg);
}
if(tv != NULL && tv->io->gemtk_user_func != NULL){
@@ -419,7 +423,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
}
-static void __CDECL on_keybd_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out,
+static void __CDECL on_keybd_event(struct core_window *cw, EVMULT_OUT *ev_out,
short msg[8])
{
bool r=false;
@@ -430,7 +434,7 @@ static void __CDECL on_keybd_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out,
unsigned short nkc = 0;
unsigned short nks = 0;
unsigned char ascii;
- struct atari_treeview_window * tv = tptr;
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
kstate = ev_out->emo_kmeta;
kcode = ev_out->emo_kreturn;
@@ -440,21 +444,20 @@ static void __CDECL on_keybd_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out,
if (ik == 0) {
if (ascii >= 9) {
- tv->io->keypress(tv, ucs4);
- //r = tree_keypress(tv->tree, ucs4);
+ tv->io->keypress(cw, ucs4);
}
} else {
- tv->io->keypress(tv, ik);
+ tv->io->keypress(cw, ik);
}
}
-static void __CDECL on_redraw_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out,
+static void __CDECL on_redraw_event(struct core_window *cw, EVMULT_OUT *ev_out,
short msg[8])
{
GRECT work, clip;
struct gemtk_wm_scroll_info_s *slid;
- struct atari_treeview_window * tv = tptr;
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
if (tv == NULL)
return;
@@ -462,7 +465,7 @@ static void __CDECL on_redraw_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out,
gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &work);
//dbg_grect("treeview work: ", &work);
- atari_treeview_get_grect(tv, TREEVIEW_AREA_CONTENT, &work);
+ atari_treeview_get_grect(cw, TREEVIEW_AREA_CONTENT, &work);
//dbg_grect("treeview work: ", &work);
slid = gemtk_wm_get_scroll_info(tv->window);
@@ -499,14 +502,14 @@ static void __CDECL on_redraw_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out,
//dbg_grect("treeview on_redraw_event ", &rdrw_area);
- atari_treeview_redraw_grect_request(tptr, &rdrw_area);
+ atari_treeview_redraw_grect_request(cw, &rdrw_area);
}
}
-static void __CDECL on_mbutton_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out,
+static void __CDECL on_mbutton_event(struct core_window *cw, EVMULT_OUT *ev_out,
short msg[8])
{
- struct atari_treeview_window * tv = tptr;
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
struct gemtk_wm_scroll_info_s *slid;
GRECT work;
short mx, my;
@@ -534,7 +537,7 @@ static void __CDECL on_mbutton_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out
&& my < work.g_y + work.g_h )
{
if (ev_out->emo_mclicks == 2) {
- tv->io->mouse_action(tv,
+ tv->io->mouse_action(cw,
BROWSER_MOUSE_CLICK_1|BROWSER_MOUSE_DOUBLE_CLICK,
origin_rel_x, origin_rel_y);
return;
@@ -547,7 +550,7 @@ static void __CDECL on_mbutton_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out
if(ev_out->emo_mclicks == 2 ) {
bms = BROWSER_MOUSE_DOUBLE_CLICK;
}
- tv->io->mouse_action(tv, bms, origin_rel_x, origin_rel_y);
+ tv->io->mouse_action(cw, bms, origin_rel_x, origin_rel_y);
} else {
/* button still pressed */
short prev_x = origin_rel_x;
@@ -561,14 +564,14 @@ static void __CDECL on_mbutton_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out
tv->startdrag.x = origin_rel_x;
tv->startdrag.y = origin_rel_y;
/* First, report mouse press, to trigger entry selection */
- tv->io->mouse_action(tv, BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_PRESS_1, cur_rel_x,
+ tv->io->mouse_action(cw, BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_PRESS_1, cur_rel_x,
cur_rel_y);
- atari_treeview_redraw(tv);
- tv->io->mouse_action(tv, BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_ON,
+ atari_treeview_redraw(cw);
+ tv->io->mouse_action(cw, BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_ON,
cur_rel_x, cur_rel_y);
do{
if (abs(prev_x-cur_rel_x) > 5 || abs(prev_y-cur_rel_y) > 5) {
- tv->io->mouse_action(tv,
+ tv->io->mouse_action(cw,
BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON,
cur_rel_x, cur_rel_y);
prev_x = cur_rel_x;
@@ -578,7 +581,7 @@ static void __CDECL on_mbutton_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out
if (tv->redraw) {
// TODO: maybe GUI poll would fit better here?
// ... is gui_poll re-entrance save?
- atari_treeview_redraw(tv);
+ atari_treeview_redraw(cw);
}
/* sample mouse button state: */
@@ -588,50 +591,50 @@ static void __CDECL on_mbutton_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out
} while( mbut & 1 );
/* End drag: */
- tv->io->mouse_action(tv, BROWSER_MOUSE_HOVER, cur_rel_x, cur_rel_y);
+ tv->io->mouse_action(cw, BROWSER_MOUSE_HOVER, cur_rel_x, cur_rel_y);
gem_set_cursor(&gem_cursors.arrow);
}
}
}
-struct atari_treeview_window *
+struct core_window *
atari_treeview_create(GUIWIN *win, struct atari_treeview_callbacks * callbacks,
void * user_data, uint32_t flags)
{
/* allocate the core_window struct: */
- struct atari_treeview_window * cw;
+ struct atari_treeview_window * tv;
struct gemtk_wm_scroll_info_s *slid;
- cw = calloc(1, sizeof(struct atari_treeview_window));
- if (cw == NULL) {
+ tv = calloc(1, sizeof(struct atari_treeview_window));
+ if (tv == NULL) {
LOG(("calloc failed"));
warn_user(messages_get_errorcode(NSERROR_NOMEM), 0);
return NULL;
}
/* Store the window ref inside the new treeview: */
- cw->window = win;
- cw->io = callbacks;
- cw->user_data = user_data;
+ tv->window = win;
+ tv->io = callbacks;
+ tv->user_data = user_data;
// Setup gemtk event handler function:
gemtk_wm_set_event_handler(win, handle_event);
// bind window user data to treeview ref:
- gemtk_wm_set_user_data(win, (void*)cw);
+ gemtk_wm_set_user_data(win, (void*)tv);
// Get acces to the gemtk scroll info struct:
- slid = gemtk_wm_get_scroll_info(cw->window);
+ slid = gemtk_wm_get_scroll_info(tv->window);
// Setup line and column height/width of the window,
// each scroll takes the configured steps:
slid->y_unit_px = 16;
slid->x_unit_px = 16;
- assert(cw->io);
- assert(cw->io->init_phase2);
+ assert(tv->io);
+ assert(tv->io->init_phase2);
/* Now that the window is configured for treeview content, */
/* call init_phase2 which must create the treeview */
@@ -639,34 +642,37 @@ atari_treeview_create(GUIWIN *win, struct atari_treeview_callbacks * callbacks,
/* event handlers of the treeview: */
/* It would be more simple to not pass around the callbacks */
/* but the treeview constructor requires them for initialization... */
- nserror err = cw->io->init_phase2(cw, &cw_t);
+ nserror err = tv->io->init_phase2((struct core_window *)tv, &cw_t);
if (err != NSERROR_OK) {
- free(cw);
- cw = NULL;
+ free(tv);
+ tv = NULL;
}
- return(cw);
+ return((struct core_window *)tv);
}
-void atari_treeview_delete(struct atari_treeview_window * cw)
+void atari_treeview_delete(struct core_window * cw)
{
- assert(cw);
- assert(cw->io->finish);
+ struct atari_treeview_window *tv = (struct atari_treeview_window*)cw;
+
+ assert(tv);
+ assert(tv->io->finish);
- cw->io->finish(cw);
+ tv->io->finish(cw);
- free(cw);
+ free(tv);
}
-void atari_treeview_open(struct atari_treeview_window *cw, GRECT *pos)
+void atari_treeview_open(struct core_window *cw, GRECT *pos)
{
- if (cw->window != NULL && cw->is_open == false) {
- cw->is_open = true;
- wind_open_grect(gemtk_wm_get_handle(cw->window), pos);
- gemtk_wm_link(cw->window);
+ struct atari_treeview_window *tv = (struct atari_treeview_window*)cw;
+ if (tv->window != NULL && tv->is_open == false) {
+ tv->is_open = true;
+ wind_open_grect(gemtk_wm_get_handle(tv->window), pos);
+ gemtk_wm_link(tv->window);
if (treeviews_open == NULL) {
- treeviews_open = cw;
+ treeviews_open = tv;
treeviews_open->next_open = NULL;
treeviews_open->prev_open = NULL;
} else {
@@ -675,44 +681,48 @@ void atari_treeview_open(struct atari_treeview_window *cw, GRECT *pos)
while(tmp->next_open != NULL){
tmp = tmp->next_open;
}
- tmp->next_open = cw;
- cw->prev_open = tmp;
- cw->next_open = NULL;
+ tmp->next_open = tv;
+ tv->prev_open = tmp;
+ tv->next_open = NULL;
}
}
}
-bool atari_treeview_is_open(struct atari_treeview_window *cw)
+bool atari_treeview_is_open(struct core_window *cw)
{
- return(cw->is_open);
+ struct atari_treeview_window *tv = (struct atari_treeview_window*)cw;
+ return(tv->is_open);
}
-void atari_treeview_set_user_data(struct atari_treeview_window * tv,
+void atari_treeview_set_user_data(struct core_window * cw,
void *user_data_ptr)
{
+ struct atari_treeview_window *tv = (struct atari_treeview_window*)cw;
tv->user_data = user_data_ptr;
}
-void * atari_treeview_get_user_data(struct atari_treeview_window * tv)
+void * atari_treeview_get_user_data(struct core_window * cw)
{
+ struct atari_treeview_window *tv = (struct atari_treeview_window*)cw;
return(tv->user_data);
}
-void atari_treeview_close(struct atari_treeview_window *cw)
+void atari_treeview_close(struct core_window *cw)
{
- if (cw->window != NULL) {
- cw->is_open = false;
- wind_close(gemtk_wm_get_handle(cw->window));
- gemtk_wm_unlink(cw->window);
+ struct atari_treeview_window *tv = (struct atari_treeview_window*)cw;
+ if (tv->window != NULL) {
+ tv->is_open = false;
+ wind_close(gemtk_wm_get_handle(tv->window));
+ gemtk_wm_unlink(tv->window);
/* unlink the window: */
struct atari_treeview_window *tmp = treeviews_open;
- if (cw->prev_open != NULL) {
- cw->prev_open->next_open = cw->next_open;
+ if (tv->prev_open != NULL) {
+ tv->prev_open->next_open = tv->next_open;
} else {
- treeviews_open = cw->next_open;
+ treeviews_open = tv->next_open;
}
- if (cw->next_open != NULL) {
- cw->next_open->prev_open = cw->prev_open;
+ if (tv->next_open != NULL) {
+ tv->next_open->prev_open = tv->prev_open;
}
}
}
@@ -732,7 +742,7 @@ void atari_treeview_redraw_request(struct core_window *cw, const struct rect *r)
{
GRECT area;
struct gemtk_wm_scroll_info_s * slid;
- struct atari_treeview_window * tv = (cw);
+ struct atari_treeview_window * tv = (struct atari_treeview_window *)cw;
RECT_TO_GRECT(r, &area)
@@ -771,7 +781,7 @@ void atari_treeview_update_size(struct core_window *cw, int width, int height)
slid = gemtk_wm_get_scroll_info(tv->window);
/* recalculate and refresh sliders: */
- atari_treeview_get_grect(tv, TREEVIEW_AREA_CONTENT, &area);
+ atari_treeview_get_grect(cw, TREEVIEW_AREA_CONTENT, &area);
if (width > -1) {
slid->x_units = (width/slid->x_unit_px);
} else {
@@ -821,7 +831,7 @@ void atari_treeview_get_window_dimensions(struct core_window *cw,
if (cw != NULL && (width != NULL || height != NULL)) {
GRECT work;
struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
- atari_treeview_get_grect(tv, TREEVIEW_AREA_CONTENT, &work);
+ atari_treeview_get_grect(cw, TREEVIEW_AREA_CONTENT, &work);
*width = work.g_w;
*height = work.g_h;
}
@@ -850,7 +860,7 @@ void atari_treeview_flush_redraws(void)
while(tmp){
assert(tmp->is_open);
if(tmp->redraw){
- atari_treeview_redraw(tmp);
+ atari_treeview_redraw((struct core_window *)tmp);
}
tmp = tmp->next_open;
}
diff --git a/atari/treeview.h b/atari/treeview.h
index d9defcc..fb4e659 100644
--- a/atari/treeview.h
+++ b/atari/treeview.h
@@ -60,20 +60,20 @@ struct atari_treeview_callbacks {
gemtk_wm_event_handler_f gemtk_user_func;
};
-struct atari_treeview_window * atari_treeview_create(GUIWIN *win,
+struct core_window *atari_treeview_create(GUIWIN *win,
struct atari_treeview_callbacks * callbacks,
void * user_data, uint32_t flags);
-void atari_treeview_delete(struct atari_treeview_window * cw);
-void atari_treeview_open(struct atari_treeview_window * cw, GRECT *pos);
-bool atari_treeview_is_open(struct atari_treeview_window *cw);
-void atari_treeview_close(struct atari_treeview_window * cw);
-GUIWIN * atari_treeview_get_gemtk_window(struct atari_treeview_window *tv);
-void atari_treeview_get_grect(ATARI_TREEVIEW_PTR tptr, enum treeview_area_e mode,
+void atari_treeview_delete(struct core_window *cw);
+void atari_treeview_open(struct core_window *cw, GRECT *pos);
+bool atari_treeview_is_open(struct core_window *cw);
+void atari_treeview_close(struct core_window *cw);
+GUIWIN * atari_treeview_get_gemtk_window(struct core_window *cw);
+void atari_treeview_get_grect(struct core_window *cw, enum treeview_area_e mode,
GRECT *dest);
-void atari_treeview_redraw(struct atari_treeview_window *tv);
-void atari_treeview_set_user_data(struct atari_treeview_window * tv,
+void atari_treeview_redraw(struct core_window *cw);
+void atari_treeview_set_user_data(struct core_window *cw,
void *user_data_ptr);
-void *atari_treeview_get_user_data(struct atari_treeview_window * tv);
+void *atari_treeview_get_user_data(struct core_window *cw);
void atari_treeview_flush_redraws(void);
#endif //NSATARI_TREEVIEW_H
--
NetSurf Browser
10 years
netsurf: branch mono/atari_treeview_rework updated. release/3.0-577-g4426e8a
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/4426e8a9eaa2fd180e881...
...commit http://git.netsurf-browser.org/netsurf.git/commit/4426e8a9eaa2fd180e88123...
...tree http://git.netsurf-browser.org/netsurf.git/tree/4426e8a9eaa2fd180e88123f7...
The branch, mono/atari_treeview_rework has been updated
via 4426e8a9eaa2fd180e88123f750e74ecb8b77625 (commit)
from ff1f5a5fafd92baf239991043c28935a669765f7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=4426e8a9eaa2fd180e8...
commit 4426e8a9eaa2fd180e88123f750e74ecb8b77625
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Added SSL Cert Inspector Window
(based on treeview API)
diff --git a/atari/Makefile.target b/atari/Makefile.target
index e47eb5d..a8bc65a 100644
--- a/atari/Makefile.target
+++ b/atari/Makefile.target
@@ -79,6 +79,7 @@ S_ATARI := \
clipboard.c \
ctxmenu.c \
cookies.c \
+ certview.c \
deskmenu.c \
download.c \
encoding.c \
diff --git a/atari/certview.c b/atari/certview.c
new file mode 100644
index 0000000..066a428
--- /dev/null
+++ b/atari/certview.c
@@ -0,0 +1,312 @@
+/*
+ * Copyright 2013 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <ctype.h>
+#include <string.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+#include "desktop/browser.h"
+#include "content/urldb.h"
+#include "desktop/sslcert_viewer.h"
+#include "desktop/gui.h"
+#include "desktop/core_window.h"
+#include "utils/nsoption.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/utils.h"
+
+#include "atari/gui.h"
+#include "atari/misc.h"
+#include "atari/treeview.h"
+#include "atari/certview.h"
+#include "atari/findfile.h"
+#include "atari/gemtk/gemtk.h"
+#include "atari/res/netsurf.rsh"
+
+extern GRECT desk_area;
+
+
+/* Setup Atari Treeview Callbacks: */
+static nserror atari_sslcert_viewer_init_phase2(struct core_window *cw,
+ struct core_window_callback_table * default_callbacks);
+static void atari_sslcert_viewer_finish(struct core_window *cw);
+static void atari_sslcert_viewer_keypress(struct core_window *cw,
+ uint32_t ucs4);
+static void atari_sslcert_viewer_mouse_action(struct core_window *cw,
+ browser_mouse_state mouse,
+ int x, int y);
+static void atari_sslcert_viewer_draw(struct core_window *cw, int x,
+ int y, struct rect *clip,
+ const struct redraw_context *ctx);
+static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]);
+
+static struct atari_treeview_callbacks atari_sslcert_viewer_treeview_callbacks = {
+ .init_phase2 = atari_sslcert_viewer_init_phase2,
+ .finish = atari_sslcert_viewer_finish,
+ .draw = atari_sslcert_viewer_draw,
+ .keypress = atari_sslcert_viewer_keypress,
+ .mouse_action = atari_sslcert_viewer_mouse_action,
+ .gemtk_user_func = handle_event
+};
+
+/* static functions */
+static void atari_sslcert_viewer_destroy(struct atari_sslcert_viewer_s * cvwin);
+
+
+static nserror atari_sslcert_viewer_init_phase2(struct core_window *cw,
+ struct core_window_callback_table *cb_t)
+{
+ LOG((""));
+
+ struct atari_treeview_window *tv;
+ struct atari_sslcert_viewer_s *cvwin;
+ struct sslcert_session_data *ssl_d;
+
+ tv = (struct atari_treeview_window *)cw;
+ cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(tv);
+
+ assert(cvwin);
+
+ ssl_d = cvwin->ssl_session_data;
+
+ assert(ssl_d);
+
+ return(sslcert_viewer_init(cb_t, cw, ssl_d));
+}
+
+static void atari_sslcert_viewer_finish(struct core_window *cw)
+{
+ struct atari_treeview_window *tv;
+ struct atari_sslcert_viewer_s *cvwin;
+
+ assert(cw);
+
+ tv = (struct atari_treeview_window *)cw;
+ cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(tv);
+
+ /* This will also free the session data: */
+ sslcert_viewer_fini(cvwin->ssl_session_data);
+
+ LOG((""));
+}
+
+static void atari_sslcert_viewer_draw(struct core_window *cw, int x,
+ int y, struct rect *clip,
+ const struct redraw_context *ctx)
+{
+ struct atari_treeview_window *tv;
+ struct atari_sslcert_viewer_s *cvwin;
+
+ assert(cw);
+
+ tv = (struct atari_treeview_window *)cw;
+ cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(tv);
+
+ assert(cvwin);
+
+ sslcert_viewer_redraw(cvwin->ssl_session_data, x, y, clip, ctx);
+}
+
+static void atari_sslcert_viewer_keypress(struct core_window *cw, uint32_t ucs4)
+{
+ struct atari_treeview_window *tv;
+ struct atari_sslcert_viewer_s *cvwin;
+
+ assert(cw);
+
+ tv = (struct atari_treeview_window *)cw;
+ cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(tv);
+
+ LOG(("ucs4: %lu\n", ucs4));
+ sslcert_viewer_keypress(cvwin->ssl_session_data, ucs4);
+}
+
+static void atari_sslcert_viewer_mouse_action(struct core_window *cw,
+ browser_mouse_state mouse,
+ int x, int y)
+{
+ struct atari_treeview_window *tv;
+ struct atari_sslcert_viewer_s *cvwin;
+
+ assert(cw);
+
+ tv = (struct atari_treeview_window *)cw;
+ cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(tv);
+
+ if((mouse & BROWSER_MOUSE_HOVER)){
+ sslcert_viewer_mouse_action(cvwin->ssl_session_data, mouse, x, y);
+ } else {
+ sslcert_viewer_mouse_action(cvwin->ssl_session_data, mouse, x, y);
+ }
+}
+
+
+static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
+{
+ struct atari_treeview_window *tv=NULL;
+ GRECT tb_area;
+ GUIWIN * gemtk_win;
+ struct gui_window * gw;
+ struct atari_sslcert_viewer_s *cvwin = NULL;
+ char *cur_url = NULL;
+ char *cur_title = NULL;
+ OBJECT *toolbar;
+
+ LOG((""));
+
+ if(ev_out->emo_events & MU_MESAG){
+ switch (msg[0]) {
+
+ case WM_TOOLBAR:
+ toolbar = gemtk_obj_get_tree(TOOLBAR_SSL_CERT);
+ LOG(("CERTVIEWER WM_TOOLBAR"));
+ tv = (struct atari_treeview_window*) gemtk_wm_get_user_data(win);
+ assert(tv);
+ cvwin = (struct atari_sslcert_viewer_s *)
+ atari_treeview_get_user_data(tv);
+ switch (msg[4]) {
+
+ case TOOLBAR_SSL_CERT_TRUSTED:
+
+ if (toolbar[msg[4]].ob_state & OS_SELECTED) {
+
+ } else {
+
+ }
+ break;
+ }
+
+
+ gemtk_win = atari_treeview_get_gemtk_window(tv);
+ assert(gemtk_win);
+ //gemtk_obj_get_tree(TOOLBAR_HOTLIST)[msg[4]].ob_state &= ~OS_SELECTED;
+ atari_treeview_get_grect(tv, TREEVIEW_AREA_TOOLBAR, &tb_area);
+ evnt_timer(150);
+ gemtk_wm_exec_redraw(gemtk_win, &tb_area);
+
+ break;
+
+ case WM_CLOSED:
+ // TODO set perrmissions
+ toolbar = gemtk_obj_get_tree(TOOLBAR_SSL_CERT);
+ tv = (struct atari_treeview_window*) gemtk_wm_get_user_data(win);
+ assert(tv);
+ cvwin = (struct atari_sslcert_viewer_s *)
+ atari_treeview_get_user_data(tv);
+ if (toolbar[TOOLBAR_SSL_CERT_TRUSTED].ob_state & OS_SELECTED) {
+ sslcert_viewer_accept(cvwin->ssl_session_data);
+ } else {
+ sslcert_viewer_reject(cvwin->ssl_session_data);
+ }
+ atari_sslcert_viewer_destroy(cvwin);
+ break;
+
+ default: break;
+ }
+ }
+}
+
+static void atari_sslcert_viewer_init(struct atari_sslcert_viewer_s * cvwin,
+ struct sslcert_session_data *ssl_d)
+{
+ assert(cvwin->init == false);
+ assert(cvwin->window == NULL);
+ assert(cvwin->tv == NULL);
+
+ int flags = ATARI_TREEVIEW_WIDGETS;
+ short handle = -1;
+ GRECT desk;
+ OBJECT * tree = gemtk_obj_get_tree(TOOLBAR_SSL_CERT);
+ assert( tree );
+
+ handle = wind_create(flags, 0, 0, desk_area.g_w, desk_area.g_h);
+ cvwin->window = gemtk_wm_add(handle,
+ GEMTK_WM_FLAG_DEFAULTS, NULL);
+ if (cvwin->window == NULL ) {
+ gemtk_msg_box_show(GEMTK_MSG_BOX_ALERT,
+ "Failed to allocate Treeview:\nCertviewer");
+ return;
+ }
+ wind_set_str(handle, WF_NAME, (char*)"SSL Certificate");
+ gemtk_wm_set_toolbar(cvwin->window, tree, 0, 0);
+ gemtk_wm_unlink(cvwin->window);
+
+ cvwin->ssl_session_data = ssl_d;
+ cvwin->tv = atari_treeview_create(cvwin->window,
+ &atari_sslcert_viewer_treeview_callbacks,
+ cvwin, flags);
+
+ if (cvwin->tv == NULL) {
+ /* handle it properly, clean up previous allocs */
+ LOG(("Failed to allocate treeview"));
+ return;
+ }
+
+ cvwin->init = true;
+}
+
+/*
+* documented in certview.h
+*/
+void atari_sslcert_viewer_open(struct sslcert_session_data *ssl_d)
+{
+ struct atari_sslcert_viewer_s * cvwin;
+
+ cvwin = calloc(1, sizeof(struct atari_sslcert_viewer_s));
+
+ assert(cvwin);
+
+ atari_sslcert_viewer_init(cvwin, ssl_d);
+
+ if (atari_treeview_is_open(cvwin->tv) == false) {
+
+ GRECT pos;
+ pos.g_x = desk_area.g_w - desk_area.g_w / 4;
+ pos.g_y = desk_area.g_y;
+ pos.g_w = desk_area.g_w / 4;
+ pos.g_h = desk_area.g_h;
+
+ atari_treeview_open(cvwin->tv, &pos);
+ } else {
+ wind_set(gemtk_wm_get_handle(cvwin->window), WF_TOP, 1, 0,
+ 0, 0);
+ }
+}
+
+
+static void atari_sslcert_viewer_destroy(struct atari_sslcert_viewer_s * cvwin)
+{
+ assert(cvwin);
+ assert(cvwin->init);
+ assert(cvwin->window);
+
+ LOG((""));
+
+ if (atari_treeview_is_open(cvwin->tv))
+ atari_treeview_close(cvwin->tv);
+ wind_delete(gemtk_wm_get_handle(cvwin->window));
+ gemtk_wm_remove(cvwin->window);
+ cvwin->window = NULL;
+ atari_treeview_delete(cvwin->tv);
+ free(cvwin);
+ LOG(("done"));
+}
+
diff --git a/atari/certview.h b/atari/certview.h
new file mode 100644
index 0000000..642e55e
--- /dev/null
+++ b/atari/certview.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2013 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef CERTVIEW_H_INCLUDED
+#define CERTVIEW_H_INCLUDED
+
+#include <inttypes.h>
+#include <sys/types.h>
+#include <string.h>
+
+
+#include "assert.h"
+#include "utils/nsoption.h"
+#include "utils/log.h"
+#include "desktop/sslcert_viewer.h"
+
+struct core_window;
+
+struct atari_sslcert_viewer_s {
+ GUIWIN * window;
+ struct atari_treeview_window *tv;/*< The hotlist treeview handle. */
+ struct sslcert_session_data *ssl_session_data;
+ bool init;
+};
+
+/**
+ * Initializes and opens an certificate inspector window
+ * \param ssl_d ssl session data created by sslcert_viewer_create_session_data
+ *
+ * The window takes ownership of the session data and free's the memory on exit.
+ */
+void atari_sslcert_viewer_open(struct sslcert_session_data *ssl_d);
+/*
+void atari_sslcert_viewer_close(void);
+void atari_sslcert_viewer_destroy(void);
+void atari_sslcert_viewer_redraw(void);
+*/
+
+#endif // CERTVIEW_H_INCLUDED
diff --git a/atari/cookies.c b/atari/cookies.c
index 9ac1890..db45f33 100644
--- a/atari/cookies.c
+++ b/atari/cookies.c
@@ -186,7 +186,7 @@ void atari_cookie_manager_init(void)
atari_cookie_manager.tv = atari_treeview_create(
atari_cookie_manager.window,
&atari_cookie_manager_treeview_callbacks,
- flags);
+ NULL, flags);
if (atari_cookie_manager.tv == NULL) {
/* handle it properly, clean up previous allocs */
diff --git a/atari/gemtk/guiwin.c b/atari/gemtk/guiwin.c
index 4ad3561..b4020e0 100644
--- a/atari/gemtk/guiwin.c
+++ b/atari/gemtk/guiwin.c
@@ -686,7 +686,7 @@ void gemtk_wm_exit(void)
GUIWIN * gemtk_wm_add(short handle, uint32_t flags, gemtk_wm_event_handler_f cb)
{
- GUIWIN *win = calloc(sizeof(GUIWIN),1);
+ GUIWIN *win = calloc(1, sizeof(GUIWIN));
assert(win!=NULL);
DEBUG_PRINT(("gemtk_wm_add: %d, %p, cb: %p\n", handle, win, cb));
diff --git a/atari/gui.c b/atari/gui.c
index c0b8cb2..427dd54 100644
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -64,6 +64,7 @@
#include "atari/toolbar.h"
#include "atari/hotlist.h"
#include "atari/cookies.h"
+#include "atari/certview.h"
#include "atari/history.h"
#include "atari/login.h"
#include "atari/encoding.h"
@@ -123,8 +124,9 @@ void gui_poll(bool active)
aes_event_in.emi_tlow = schedule_run();
- if(active || rendering)
- aes_event_in.emi_tlow = 0;
+ if(active || rendering){
+ aes_event_in.emi_tlow = 10;
+ }
if(aes_event_in.emi_tlow < 0) {
aes_event_in.emi_tlow = 10000;
@@ -175,9 +177,7 @@ void gui_poll(bool active)
// TODO: implement generic treeview redraw function
// TODO: rename hl to atari_hotlist or create getter for it...
- atari_hotlist_redraw();
- atari_cookie_manager_redraw();
- atari_global_history_redraw();
+ atari_treeview_flush_redraws();
}
@@ -191,7 +191,7 @@ gui_create_browser_window(struct browser_window *bw,
(int)new_tab
));
- gw = calloc( sizeof(struct gui_window), 1);
+ gw = calloc(1, sizeof(struct gui_window));
if (gw == NULL)
return NULL;
@@ -539,11 +539,6 @@ void gui_window_set_url(struct gui_window *w, const char *url)
}
}
-struct gui_window * gui_window_get_input_window(void)
-{
- return(input_window);
-}
-
char * gui_window_get_url(struct gui_window *gw)
{
if (gw == NULL) {
@@ -799,19 +794,31 @@ void gui_401login_open(nsurl *url, const char *realm,
}
void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
- unsigned long num,
- nserror (*cb)(bool proceed, void *pw), void *cbpw)
+ unsigned long num, nserror (*cb)(bool proceed, void *pw),
+ void *cbpw)
{
+ struct sslcert_session_data *data;
LOG((""));
bool bres;
// TODO: localize string
- int b = form_alert(1, "[2][SSL Verify failed, continue?][Continue|Abort]");
- bres = (b==1)? true : false;
- LOG(("Trust: %d", bres ));
- urldb_set_cert_permissions(url, bres);
- cb(bres, cbpw);
+ int b = form_alert(1, "[2][SSL Verify failed, continue?][Continue|Abort|Details...]");
+ if(b == 1){
+ // Accept
+ urldb_set_cert_permissions(url, true);
+ cb(true, cbpw);
+ } else if(b == 2) {
+ // Reject
+ urldb_set_cert_permissions(url, false);
+ cb(false, cbpw);
+ } else if(b == 3) {
+ // Inspect
+ sslcert_viewer_create_session_data(num, url, cb, cbpw, certs,
+ &data);
+ atari_sslcert_viewer_open(data);
+ }
+
}
void gui_set_input_gui_window(struct gui_window *gw)
@@ -820,6 +827,11 @@ void gui_set_input_gui_window(struct gui_window *gw)
input_window = gw;
}
+struct gui_window * gui_get_input_window(void)
+{
+ return(input_window);
+}
+
void gui_quit(void)
{
LOG((""));
diff --git a/atari/gui.h b/atari/gui.h
index c582d66..a1135e2 100755
--- a/atari/gui.h
+++ b/atari/gui.h
@@ -160,6 +160,7 @@ extern struct gui_window *window_list;
/* Public - non core gui window functions */
/* -------------------------------------------------------------------------- */
void gui_set_input_gui_window(struct gui_window *gw);
+struct gui_window *gui_get_input_window(void);
char *gui_window_get_url(struct gui_window *gw);
char * gui_window_get_title(struct gui_window *gw);
diff --git a/atari/history.c b/atari/history.c
index c43b829..487030f 100644
--- a/atari/history.c
+++ b/atari/history.c
@@ -211,7 +211,7 @@ void atari_global_history_init(void)
atari_global_history.tv = atari_treeview_create(
atari_global_history.window,
&atari_global_history_treeview_callbacks,
- flags);
+ NULL, flags);
if (atari_global_history.tv == NULL) {
/* handle it properly, clean up previous allocs */
diff --git a/atari/hotlist.c b/atari/hotlist.c
index 016cbc4..8db18b0 100644
--- a/atari/hotlist.c
+++ b/atari/hotlist.c
@@ -137,14 +137,14 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
break;
case TOOLBAR_HOTLIST_ADD:
- gw = gui_window_get_input_window();
+ gw = gui_get_input_window();
if(gw && gw->browser){
cur_url = gui_window_get_url(gw);
cur_title = gui_window_get_title(gw);
// TODO: read language string.
- cur_title = (cur_title ? cur_title : "New bookmark");
+ cur_title = (cur_title ? cur_title : (char*)"New bookmark");
} else {
- cur_url = "http://www";
+ cur_url = (char*)"http://www";
}
atari_hotlist_add_page(cur_url, cur_title);
break;
@@ -214,7 +214,7 @@ void atari_hotlist_init(void)
tree_hotlist_path = (const char*)&hl.path;
hl.tv = atari_treeview_create(hl.window, &atari_hotlist_treeview_callbacks,
- flags);
+ NULL, flags);
if (hl.tv == NULL) {
/* handle it properly, clean up previous allocs */
diff --git a/atari/res/netsurf.rsc b/atari/res/netsurf.rsc
index 2137328..b5ea38b 100755
Binary files a/atari/res/netsurf.rsc and b/atari/res/netsurf.rsc differ
diff --git a/atari/res/netsurf.rsh b/atari/res/netsurf.rsh
index 6797c05..0396841 100755
--- a/atari/res/netsurf.rsh
+++ b/atari/res/netsurf.rsh
@@ -214,3 +214,6 @@
#define TOOLBAR_COOKIES 16 /* form/dial */
#define TOOLBAR_HISTORY 17 /* form/dial */
+
+#define TOOLBAR_SSL_CERT 18 /* form/dial */
+#define TOOLBAR_SSL_CERT_TRUSTED 1 /* BUTTON in tree TOOLBAR_SSL_CERT */
diff --git a/atari/res/netsurf.rsm b/atari/res/netsurf.rsm
index 27df3d7..e279d4a 100755
--- a/atari/res/netsurf.rsm
+++ b/atari/res/netsurf.rsm
@@ -1,9 +1,9 @@
ResourceMaster v3.65
-#C 18@0@0@0@
+#C 19@0@0@0@
#N 99@32@AZAaza___ _@AZAaza090___ _@@_@
#FoC-Header@rsm2out@C-Header@rsh@@@[C-Header@0@
#R 0@0@1@1@2@1@
-#M 20010100@0@7728@643@
+#M 20010100@0@7728@646@
#T 0@1@MAINMENU@@64@@
#O 4@32@T_FILE@@
#O 5@32@T_EDIT@@
@@ -199,4 +199,6 @@ ResourceMaster v3.65
#O 2@28@FREETYPE@@
#T 16@2@TOOLBAR_COOKIES@@1@@
#T 17@2@TOOLBAR_HISTORY@@1@@
-#c 24594@
+#T 18@2@TOOLBAR_SSL_CERT@@2@@
+#O 1@26@TRUSTED@@
+#c 26341@
diff --git a/atari/toolbar.c b/atari/toolbar.c
index 6c08428..4a63787 100644
--- a/atari/toolbar.c
+++ b/atari/toolbar.c
@@ -281,7 +281,7 @@ struct s_toolbar *toolbar_create(struct s_gui_win_root *owner)
assert(init == true);
- t = calloc(sizeof(struct s_toolbar), 1);
+ t = calloc(1, sizeof(struct s_toolbar));
assert(t);
diff --git a/atari/treeview.c b/atari/treeview.c
index 99711c0..bd82177 100644
--- a/atari/treeview.c
+++ b/atari/treeview.c
@@ -51,10 +51,10 @@ void atari_treeview_scroll_visible(struct core_window *cw,
const struct rect *r);
void atari_treeview_get_window_dimensions(struct core_window *cw,
int *width, int *height);
+ // TODO: implement drag status!
void atari_treeview_drag_status(struct core_window *cw,
core_window_drag_status ds);
-
static struct core_window_callback_table cw_t = {
.redraw_request = atari_treeview_redraw_request,
.update_size = atari_treeview_update_size,
@@ -65,6 +65,8 @@ static struct core_window_callback_table cw_t = {
struct atari_treeview_window {
+ struct atari_treeview_window * prev_open;
+ struct atari_treeview_window * next_open;
GUIWIN * window;
bool disposing;
bool redraw;
@@ -74,8 +76,11 @@ struct atari_treeview_window {
POINT click;
POINT startdrag;
struct atari_treeview_callbacks *io;
+ void * user_data;
};
+static struct atari_treeview_window * treeviews_open;
+
/* native GUI event handlers: */
static void on_mbutton_event(struct atari_treeview_window *tvw,
EVMULT_OUT *ev_out, short msg[8]);
@@ -509,8 +514,7 @@ static void __CDECL on_mbutton_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out
bool ignore=false;
short cur_rel_x, cur_rel_y, dummy, mbut;
- if(tv == NULL)
- return;
+ assert(tv);
gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &work);
slid = gemtk_wm_get_scroll_info(tv->window);
@@ -593,14 +597,14 @@ static void __CDECL on_mbutton_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out
struct atari_treeview_window *
atari_treeview_create(GUIWIN *win, struct atari_treeview_callbacks * callbacks,
- uint32_t flags)
+ void * user_data, uint32_t flags)
{
/* allocate the core_window struct: */
struct atari_treeview_window * cw;
struct gemtk_wm_scroll_info_s *slid;
- cw = calloc(sizeof(struct atari_treeview_window), 1);
+ cw = calloc(1, sizeof(struct atari_treeview_window));
if (cw == NULL) {
LOG(("calloc failed"));
warn_user(messages_get_errorcode(NSERROR_NOMEM), 0);
@@ -610,6 +614,7 @@ atari_treeview_create(GUIWIN *win, struct atari_treeview_callbacks * callbacks,
/* Store the window ref inside the new treeview: */
cw->window = win;
cw->io = callbacks;
+ cw->user_data = user_data;
// Setup gemtk event handler function:
gemtk_wm_set_event_handler(win, handle_event);
@@ -656,10 +661,24 @@ void atari_treeview_delete(struct atari_treeview_window * cw)
void atari_treeview_open(struct atari_treeview_window *cw, GRECT *pos)
{
- if (cw->window != NULL) {
+ if (cw->window != NULL && cw->is_open == false) {
cw->is_open = true;
wind_open_grect(gemtk_wm_get_handle(cw->window), pos);
gemtk_wm_link(cw->window);
+ if (treeviews_open == NULL) {
+ treeviews_open = cw;
+ treeviews_open->next_open = NULL;
+ treeviews_open->prev_open = NULL;
+ } else {
+ struct atari_treeview_window * tmp;
+ tmp = treeviews_open;
+ while(tmp->next_open != NULL){
+ tmp = tmp->next_open;
+ }
+ tmp->next_open = cw;
+ cw->prev_open = tmp;
+ cw->next_open = NULL;
+ }
}
}
@@ -668,12 +687,33 @@ bool atari_treeview_is_open(struct atari_treeview_window *cw)
return(cw->is_open);
}
+void atari_treeview_set_user_data(struct atari_treeview_window * tv,
+ void *user_data_ptr)
+{
+ tv->user_data = user_data_ptr;
+}
+
+void * atari_treeview_get_user_data(struct atari_treeview_window * tv)
+{
+ return(tv->user_data);
+}
+
void atari_treeview_close(struct atari_treeview_window *cw)
{
if (cw->window != NULL) {
cw->is_open = false;
wind_close(gemtk_wm_get_handle(cw->window));
gemtk_wm_unlink(cw->window);
+ /* unlink the window: */
+ struct atari_treeview_window *tmp = treeviews_open;
+ if (cw->prev_open != NULL) {
+ cw->prev_open->next_open = cw->next_open;
+ } else {
+ treeviews_open = cw->next_open;
+ }
+ if (cw->next_open != NULL) {
+ cw->next_open->prev_open = cw->prev_open;
+ }
}
}
@@ -800,3 +840,20 @@ void atari_treeview_drag_status(struct core_window *cw,
}
+void atari_treeview_flush_redraws(void)
+{
+ struct atari_treeview_window *tmp;
+
+ tmp = treeviews_open;
+
+ if(tmp){
+ while(tmp){
+ assert(tmp->is_open);
+ if(tmp->redraw){
+ atari_treeview_redraw(tmp);
+ }
+ tmp = tmp->next_open;
+ }
+ }
+}
+
diff --git a/atari/treeview.h b/atari/treeview.h
index bab20c4..d9defcc 100644
--- a/atari/treeview.h
+++ b/atari/treeview.h
@@ -60,9 +60,9 @@ struct atari_treeview_callbacks {
gemtk_wm_event_handler_f gemtk_user_func;
};
-struct atari_treeview_window *
-atari_treeview_create(GUIWIN *win, struct atari_treeview_callbacks * callbacks,
- uint32_t flags);
+struct atari_treeview_window * atari_treeview_create(GUIWIN *win,
+ struct atari_treeview_callbacks * callbacks,
+ void * user_data, uint32_t flags);
void atari_treeview_delete(struct atari_treeview_window * cw);
void atari_treeview_open(struct atari_treeview_window * cw, GRECT *pos);
bool atari_treeview_is_open(struct atari_treeview_window *cw);
@@ -71,5 +71,9 @@ GUIWIN * atari_treeview_get_gemtk_window(struct atari_treeview_window *tv);
void atari_treeview_get_grect(ATARI_TREEVIEW_PTR tptr, enum treeview_area_e mode,
GRECT *dest);
void atari_treeview_redraw(struct atari_treeview_window *tv);
+void atari_treeview_set_user_data(struct atari_treeview_window * tv,
+ void *user_data_ptr);
+void *atari_treeview_get_user_data(struct atari_treeview_window * tv);
+void atari_treeview_flush_redraws(void);
#endif //NSATARI_TREEVIEW_H
-----------------------------------------------------------------------
Summary of changes:
atari/Makefile.target | 1 +
atari/certview.c | 312 +++++++++++++++++++++++++++++++++++++++++++++++++
atari/certview.h | 54 +++++++++
atari/cookies.c | 2 +-
atari/gemtk/guiwin.c | 2 +-
atari/gui.c | 48 +++++---
atari/gui.h | 1 +
atari/history.c | 2 +-
atari/hotlist.c | 8 +-
atari/res/netsurf.rsc | Bin 34722 -> 34782 bytes
atari/res/netsurf.rsh | 3 +
atari/res/netsurf.rsm | 8 +-
atari/toolbar.c | 2 +-
atari/treeview.c | 69 ++++++++++-
atari/treeview.h | 10 +-
15 files changed, 484 insertions(+), 38 deletions(-)
create mode 100644 atari/certview.c
create mode 100644 atari/certview.h
diff --git a/atari/Makefile.target b/atari/Makefile.target
index e47eb5d..a8bc65a 100644
--- a/atari/Makefile.target
+++ b/atari/Makefile.target
@@ -79,6 +79,7 @@ S_ATARI := \
clipboard.c \
ctxmenu.c \
cookies.c \
+ certview.c \
deskmenu.c \
download.c \
encoding.c \
diff --git a/atari/certview.c b/atari/certview.c
new file mode 100644
index 0000000..066a428
--- /dev/null
+++ b/atari/certview.c
@@ -0,0 +1,312 @@
+/*
+ * Copyright 2013 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <ctype.h>
+#include <string.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+#include "desktop/browser.h"
+#include "content/urldb.h"
+#include "desktop/sslcert_viewer.h"
+#include "desktop/gui.h"
+#include "desktop/core_window.h"
+#include "utils/nsoption.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/utils.h"
+
+#include "atari/gui.h"
+#include "atari/misc.h"
+#include "atari/treeview.h"
+#include "atari/certview.h"
+#include "atari/findfile.h"
+#include "atari/gemtk/gemtk.h"
+#include "atari/res/netsurf.rsh"
+
+extern GRECT desk_area;
+
+
+/* Setup Atari Treeview Callbacks: */
+static nserror atari_sslcert_viewer_init_phase2(struct core_window *cw,
+ struct core_window_callback_table * default_callbacks);
+static void atari_sslcert_viewer_finish(struct core_window *cw);
+static void atari_sslcert_viewer_keypress(struct core_window *cw,
+ uint32_t ucs4);
+static void atari_sslcert_viewer_mouse_action(struct core_window *cw,
+ browser_mouse_state mouse,
+ int x, int y);
+static void atari_sslcert_viewer_draw(struct core_window *cw, int x,
+ int y, struct rect *clip,
+ const struct redraw_context *ctx);
+static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]);
+
+static struct atari_treeview_callbacks atari_sslcert_viewer_treeview_callbacks = {
+ .init_phase2 = atari_sslcert_viewer_init_phase2,
+ .finish = atari_sslcert_viewer_finish,
+ .draw = atari_sslcert_viewer_draw,
+ .keypress = atari_sslcert_viewer_keypress,
+ .mouse_action = atari_sslcert_viewer_mouse_action,
+ .gemtk_user_func = handle_event
+};
+
+/* static functions */
+static void atari_sslcert_viewer_destroy(struct atari_sslcert_viewer_s * cvwin);
+
+
+static nserror atari_sslcert_viewer_init_phase2(struct core_window *cw,
+ struct core_window_callback_table *cb_t)
+{
+ LOG((""));
+
+ struct atari_treeview_window *tv;
+ struct atari_sslcert_viewer_s *cvwin;
+ struct sslcert_session_data *ssl_d;
+
+ tv = (struct atari_treeview_window *)cw;
+ cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(tv);
+
+ assert(cvwin);
+
+ ssl_d = cvwin->ssl_session_data;
+
+ assert(ssl_d);
+
+ return(sslcert_viewer_init(cb_t, cw, ssl_d));
+}
+
+static void atari_sslcert_viewer_finish(struct core_window *cw)
+{
+ struct atari_treeview_window *tv;
+ struct atari_sslcert_viewer_s *cvwin;
+
+ assert(cw);
+
+ tv = (struct atari_treeview_window *)cw;
+ cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(tv);
+
+ /* This will also free the session data: */
+ sslcert_viewer_fini(cvwin->ssl_session_data);
+
+ LOG((""));
+}
+
+static void atari_sslcert_viewer_draw(struct core_window *cw, int x,
+ int y, struct rect *clip,
+ const struct redraw_context *ctx)
+{
+ struct atari_treeview_window *tv;
+ struct atari_sslcert_viewer_s *cvwin;
+
+ assert(cw);
+
+ tv = (struct atari_treeview_window *)cw;
+ cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(tv);
+
+ assert(cvwin);
+
+ sslcert_viewer_redraw(cvwin->ssl_session_data, x, y, clip, ctx);
+}
+
+static void atari_sslcert_viewer_keypress(struct core_window *cw, uint32_t ucs4)
+{
+ struct atari_treeview_window *tv;
+ struct atari_sslcert_viewer_s *cvwin;
+
+ assert(cw);
+
+ tv = (struct atari_treeview_window *)cw;
+ cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(tv);
+
+ LOG(("ucs4: %lu\n", ucs4));
+ sslcert_viewer_keypress(cvwin->ssl_session_data, ucs4);
+}
+
+static void atari_sslcert_viewer_mouse_action(struct core_window *cw,
+ browser_mouse_state mouse,
+ int x, int y)
+{
+ struct atari_treeview_window *tv;
+ struct atari_sslcert_viewer_s *cvwin;
+
+ assert(cw);
+
+ tv = (struct atari_treeview_window *)cw;
+ cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(tv);
+
+ if((mouse & BROWSER_MOUSE_HOVER)){
+ sslcert_viewer_mouse_action(cvwin->ssl_session_data, mouse, x, y);
+ } else {
+ sslcert_viewer_mouse_action(cvwin->ssl_session_data, mouse, x, y);
+ }
+}
+
+
+static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
+{
+ struct atari_treeview_window *tv=NULL;
+ GRECT tb_area;
+ GUIWIN * gemtk_win;
+ struct gui_window * gw;
+ struct atari_sslcert_viewer_s *cvwin = NULL;
+ char *cur_url = NULL;
+ char *cur_title = NULL;
+ OBJECT *toolbar;
+
+ LOG((""));
+
+ if(ev_out->emo_events & MU_MESAG){
+ switch (msg[0]) {
+
+ case WM_TOOLBAR:
+ toolbar = gemtk_obj_get_tree(TOOLBAR_SSL_CERT);
+ LOG(("CERTVIEWER WM_TOOLBAR"));
+ tv = (struct atari_treeview_window*) gemtk_wm_get_user_data(win);
+ assert(tv);
+ cvwin = (struct atari_sslcert_viewer_s *)
+ atari_treeview_get_user_data(tv);
+ switch (msg[4]) {
+
+ case TOOLBAR_SSL_CERT_TRUSTED:
+
+ if (toolbar[msg[4]].ob_state & OS_SELECTED) {
+
+ } else {
+
+ }
+ break;
+ }
+
+
+ gemtk_win = atari_treeview_get_gemtk_window(tv);
+ assert(gemtk_win);
+ //gemtk_obj_get_tree(TOOLBAR_HOTLIST)[msg[4]].ob_state &= ~OS_SELECTED;
+ atari_treeview_get_grect(tv, TREEVIEW_AREA_TOOLBAR, &tb_area);
+ evnt_timer(150);
+ gemtk_wm_exec_redraw(gemtk_win, &tb_area);
+
+ break;
+
+ case WM_CLOSED:
+ // TODO set perrmissions
+ toolbar = gemtk_obj_get_tree(TOOLBAR_SSL_CERT);
+ tv = (struct atari_treeview_window*) gemtk_wm_get_user_data(win);
+ assert(tv);
+ cvwin = (struct atari_sslcert_viewer_s *)
+ atari_treeview_get_user_data(tv);
+ if (toolbar[TOOLBAR_SSL_CERT_TRUSTED].ob_state & OS_SELECTED) {
+ sslcert_viewer_accept(cvwin->ssl_session_data);
+ } else {
+ sslcert_viewer_reject(cvwin->ssl_session_data);
+ }
+ atari_sslcert_viewer_destroy(cvwin);
+ break;
+
+ default: break;
+ }
+ }
+}
+
+static void atari_sslcert_viewer_init(struct atari_sslcert_viewer_s * cvwin,
+ struct sslcert_session_data *ssl_d)
+{
+ assert(cvwin->init == false);
+ assert(cvwin->window == NULL);
+ assert(cvwin->tv == NULL);
+
+ int flags = ATARI_TREEVIEW_WIDGETS;
+ short handle = -1;
+ GRECT desk;
+ OBJECT * tree = gemtk_obj_get_tree(TOOLBAR_SSL_CERT);
+ assert( tree );
+
+ handle = wind_create(flags, 0, 0, desk_area.g_w, desk_area.g_h);
+ cvwin->window = gemtk_wm_add(handle,
+ GEMTK_WM_FLAG_DEFAULTS, NULL);
+ if (cvwin->window == NULL ) {
+ gemtk_msg_box_show(GEMTK_MSG_BOX_ALERT,
+ "Failed to allocate Treeview:\nCertviewer");
+ return;
+ }
+ wind_set_str(handle, WF_NAME, (char*)"SSL Certificate");
+ gemtk_wm_set_toolbar(cvwin->window, tree, 0, 0);
+ gemtk_wm_unlink(cvwin->window);
+
+ cvwin->ssl_session_data = ssl_d;
+ cvwin->tv = atari_treeview_create(cvwin->window,
+ &atari_sslcert_viewer_treeview_callbacks,
+ cvwin, flags);
+
+ if (cvwin->tv == NULL) {
+ /* handle it properly, clean up previous allocs */
+ LOG(("Failed to allocate treeview"));
+ return;
+ }
+
+ cvwin->init = true;
+}
+
+/*
+* documented in certview.h
+*/
+void atari_sslcert_viewer_open(struct sslcert_session_data *ssl_d)
+{
+ struct atari_sslcert_viewer_s * cvwin;
+
+ cvwin = calloc(1, sizeof(struct atari_sslcert_viewer_s));
+
+ assert(cvwin);
+
+ atari_sslcert_viewer_init(cvwin, ssl_d);
+
+ if (atari_treeview_is_open(cvwin->tv) == false) {
+
+ GRECT pos;
+ pos.g_x = desk_area.g_w - desk_area.g_w / 4;
+ pos.g_y = desk_area.g_y;
+ pos.g_w = desk_area.g_w / 4;
+ pos.g_h = desk_area.g_h;
+
+ atari_treeview_open(cvwin->tv, &pos);
+ } else {
+ wind_set(gemtk_wm_get_handle(cvwin->window), WF_TOP, 1, 0,
+ 0, 0);
+ }
+}
+
+
+static void atari_sslcert_viewer_destroy(struct atari_sslcert_viewer_s * cvwin)
+{
+ assert(cvwin);
+ assert(cvwin->init);
+ assert(cvwin->window);
+
+ LOG((""));
+
+ if (atari_treeview_is_open(cvwin->tv))
+ atari_treeview_close(cvwin->tv);
+ wind_delete(gemtk_wm_get_handle(cvwin->window));
+ gemtk_wm_remove(cvwin->window);
+ cvwin->window = NULL;
+ atari_treeview_delete(cvwin->tv);
+ free(cvwin);
+ LOG(("done"));
+}
+
diff --git a/atari/certview.h b/atari/certview.h
new file mode 100644
index 0000000..642e55e
--- /dev/null
+++ b/atari/certview.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2013 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef CERTVIEW_H_INCLUDED
+#define CERTVIEW_H_INCLUDED
+
+#include <inttypes.h>
+#include <sys/types.h>
+#include <string.h>
+
+
+#include "assert.h"
+#include "utils/nsoption.h"
+#include "utils/log.h"
+#include "desktop/sslcert_viewer.h"
+
+struct core_window;
+
+struct atari_sslcert_viewer_s {
+ GUIWIN * window;
+ struct atari_treeview_window *tv;/*< The hotlist treeview handle. */
+ struct sslcert_session_data *ssl_session_data;
+ bool init;
+};
+
+/**
+ * Initializes and opens an certificate inspector window
+ * \param ssl_d ssl session data created by sslcert_viewer_create_session_data
+ *
+ * The window takes ownership of the session data and free's the memory on exit.
+ */
+void atari_sslcert_viewer_open(struct sslcert_session_data *ssl_d);
+/*
+void atari_sslcert_viewer_close(void);
+void atari_sslcert_viewer_destroy(void);
+void atari_sslcert_viewer_redraw(void);
+*/
+
+#endif // CERTVIEW_H_INCLUDED
diff --git a/atari/cookies.c b/atari/cookies.c
index 9ac1890..db45f33 100644
--- a/atari/cookies.c
+++ b/atari/cookies.c
@@ -186,7 +186,7 @@ void atari_cookie_manager_init(void)
atari_cookie_manager.tv = atari_treeview_create(
atari_cookie_manager.window,
&atari_cookie_manager_treeview_callbacks,
- flags);
+ NULL, flags);
if (atari_cookie_manager.tv == NULL) {
/* handle it properly, clean up previous allocs */
diff --git a/atari/gemtk/guiwin.c b/atari/gemtk/guiwin.c
index 4ad3561..b4020e0 100644
--- a/atari/gemtk/guiwin.c
+++ b/atari/gemtk/guiwin.c
@@ -686,7 +686,7 @@ void gemtk_wm_exit(void)
GUIWIN * gemtk_wm_add(short handle, uint32_t flags, gemtk_wm_event_handler_f cb)
{
- GUIWIN *win = calloc(sizeof(GUIWIN),1);
+ GUIWIN *win = calloc(1, sizeof(GUIWIN));
assert(win!=NULL);
DEBUG_PRINT(("gemtk_wm_add: %d, %p, cb: %p\n", handle, win, cb));
diff --git a/atari/gui.c b/atari/gui.c
index c0b8cb2..427dd54 100644
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -64,6 +64,7 @@
#include "atari/toolbar.h"
#include "atari/hotlist.h"
#include "atari/cookies.h"
+#include "atari/certview.h"
#include "atari/history.h"
#include "atari/login.h"
#include "atari/encoding.h"
@@ -123,8 +124,9 @@ void gui_poll(bool active)
aes_event_in.emi_tlow = schedule_run();
- if(active || rendering)
- aes_event_in.emi_tlow = 0;
+ if(active || rendering){
+ aes_event_in.emi_tlow = 10;
+ }
if(aes_event_in.emi_tlow < 0) {
aes_event_in.emi_tlow = 10000;
@@ -175,9 +177,7 @@ void gui_poll(bool active)
// TODO: implement generic treeview redraw function
// TODO: rename hl to atari_hotlist or create getter for it...
- atari_hotlist_redraw();
- atari_cookie_manager_redraw();
- atari_global_history_redraw();
+ atari_treeview_flush_redraws();
}
@@ -191,7 +191,7 @@ gui_create_browser_window(struct browser_window *bw,
(int)new_tab
));
- gw = calloc( sizeof(struct gui_window), 1);
+ gw = calloc(1, sizeof(struct gui_window));
if (gw == NULL)
return NULL;
@@ -539,11 +539,6 @@ void gui_window_set_url(struct gui_window *w, const char *url)
}
}
-struct gui_window * gui_window_get_input_window(void)
-{
- return(input_window);
-}
-
char * gui_window_get_url(struct gui_window *gw)
{
if (gw == NULL) {
@@ -799,19 +794,31 @@ void gui_401login_open(nsurl *url, const char *realm,
}
void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
- unsigned long num,
- nserror (*cb)(bool proceed, void *pw), void *cbpw)
+ unsigned long num, nserror (*cb)(bool proceed, void *pw),
+ void *cbpw)
{
+ struct sslcert_session_data *data;
LOG((""));
bool bres;
// TODO: localize string
- int b = form_alert(1, "[2][SSL Verify failed, continue?][Continue|Abort]");
- bres = (b==1)? true : false;
- LOG(("Trust: %d", bres ));
- urldb_set_cert_permissions(url, bres);
- cb(bres, cbpw);
+ int b = form_alert(1, "[2][SSL Verify failed, continue?][Continue|Abort|Details...]");
+ if(b == 1){
+ // Accept
+ urldb_set_cert_permissions(url, true);
+ cb(true, cbpw);
+ } else if(b == 2) {
+ // Reject
+ urldb_set_cert_permissions(url, false);
+ cb(false, cbpw);
+ } else if(b == 3) {
+ // Inspect
+ sslcert_viewer_create_session_data(num, url, cb, cbpw, certs,
+ &data);
+ atari_sslcert_viewer_open(data);
+ }
+
}
void gui_set_input_gui_window(struct gui_window *gw)
@@ -820,6 +827,11 @@ void gui_set_input_gui_window(struct gui_window *gw)
input_window = gw;
}
+struct gui_window * gui_get_input_window(void)
+{
+ return(input_window);
+}
+
void gui_quit(void)
{
LOG((""));
diff --git a/atari/gui.h b/atari/gui.h
index c582d66..a1135e2 100755
--- a/atari/gui.h
+++ b/atari/gui.h
@@ -160,6 +160,7 @@ extern struct gui_window *window_list;
/* Public - non core gui window functions */
/* -------------------------------------------------------------------------- */
void gui_set_input_gui_window(struct gui_window *gw);
+struct gui_window *gui_get_input_window(void);
char *gui_window_get_url(struct gui_window *gw);
char * gui_window_get_title(struct gui_window *gw);
diff --git a/atari/history.c b/atari/history.c
index c43b829..487030f 100644
--- a/atari/history.c
+++ b/atari/history.c
@@ -211,7 +211,7 @@ void atari_global_history_init(void)
atari_global_history.tv = atari_treeview_create(
atari_global_history.window,
&atari_global_history_treeview_callbacks,
- flags);
+ NULL, flags);
if (atari_global_history.tv == NULL) {
/* handle it properly, clean up previous allocs */
diff --git a/atari/hotlist.c b/atari/hotlist.c
index 016cbc4..8db18b0 100644
--- a/atari/hotlist.c
+++ b/atari/hotlist.c
@@ -137,14 +137,14 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
break;
case TOOLBAR_HOTLIST_ADD:
- gw = gui_window_get_input_window();
+ gw = gui_get_input_window();
if(gw && gw->browser){
cur_url = gui_window_get_url(gw);
cur_title = gui_window_get_title(gw);
// TODO: read language string.
- cur_title = (cur_title ? cur_title : "New bookmark");
+ cur_title = (cur_title ? cur_title : (char*)"New bookmark");
} else {
- cur_url = "http://www";
+ cur_url = (char*)"http://www";
}
atari_hotlist_add_page(cur_url, cur_title);
break;
@@ -214,7 +214,7 @@ void atari_hotlist_init(void)
tree_hotlist_path = (const char*)&hl.path;
hl.tv = atari_treeview_create(hl.window, &atari_hotlist_treeview_callbacks,
- flags);
+ NULL, flags);
if (hl.tv == NULL) {
/* handle it properly, clean up previous allocs */
diff --git a/atari/res/netsurf.rsc b/atari/res/netsurf.rsc
index 2137328..b5ea38b 100755
Binary files a/atari/res/netsurf.rsc and b/atari/res/netsurf.rsc differ
diff --git a/atari/res/netsurf.rsh b/atari/res/netsurf.rsh
index 6797c05..0396841 100755
--- a/atari/res/netsurf.rsh
+++ b/atari/res/netsurf.rsh
@@ -214,3 +214,6 @@
#define TOOLBAR_COOKIES 16 /* form/dial */
#define TOOLBAR_HISTORY 17 /* form/dial */
+
+#define TOOLBAR_SSL_CERT 18 /* form/dial */
+#define TOOLBAR_SSL_CERT_TRUSTED 1 /* BUTTON in tree TOOLBAR_SSL_CERT */
diff --git a/atari/res/netsurf.rsm b/atari/res/netsurf.rsm
index 27df3d7..e279d4a 100755
--- a/atari/res/netsurf.rsm
+++ b/atari/res/netsurf.rsm
@@ -1,9 +1,9 @@
ResourceMaster v3.65
-#C 18@0@0@0@
+#C 19@0@0@0@
#N 99@32@AZAaza___ _@AZAaza090___ _@@_@
#FoC-Header@rsm2out@C-Header@rsh@@@[C-Header@0@
#R 0@0@1@1@2@1@
-#M 20010100@0@7728@643@
+#M 20010100@0@7728@646@
#T 0@1@MAINMENU@@64@@
#O 4@32@T_FILE@@
#O 5@32@T_EDIT@@
@@ -199,4 +199,6 @@ ResourceMaster v3.65
#O 2@28@FREETYPE@@
#T 16@2@TOOLBAR_COOKIES@@1@@
#T 17@2@TOOLBAR_HISTORY@@1@@
-#c 24594@
+#T 18@2@TOOLBAR_SSL_CERT@@2@@
+#O 1@26@TRUSTED@@
+#c 26341@
diff --git a/atari/toolbar.c b/atari/toolbar.c
index 6c08428..4a63787 100644
--- a/atari/toolbar.c
+++ b/atari/toolbar.c
@@ -281,7 +281,7 @@ struct s_toolbar *toolbar_create(struct s_gui_win_root *owner)
assert(init == true);
- t = calloc(sizeof(struct s_toolbar), 1);
+ t = calloc(1, sizeof(struct s_toolbar));
assert(t);
diff --git a/atari/treeview.c b/atari/treeview.c
index 99711c0..bd82177 100644
--- a/atari/treeview.c
+++ b/atari/treeview.c
@@ -51,10 +51,10 @@ void atari_treeview_scroll_visible(struct core_window *cw,
const struct rect *r);
void atari_treeview_get_window_dimensions(struct core_window *cw,
int *width, int *height);
+ // TODO: implement drag status!
void atari_treeview_drag_status(struct core_window *cw,
core_window_drag_status ds);
-
static struct core_window_callback_table cw_t = {
.redraw_request = atari_treeview_redraw_request,
.update_size = atari_treeview_update_size,
@@ -65,6 +65,8 @@ static struct core_window_callback_table cw_t = {
struct atari_treeview_window {
+ struct atari_treeview_window * prev_open;
+ struct atari_treeview_window * next_open;
GUIWIN * window;
bool disposing;
bool redraw;
@@ -74,8 +76,11 @@ struct atari_treeview_window {
POINT click;
POINT startdrag;
struct atari_treeview_callbacks *io;
+ void * user_data;
};
+static struct atari_treeview_window * treeviews_open;
+
/* native GUI event handlers: */
static void on_mbutton_event(struct atari_treeview_window *tvw,
EVMULT_OUT *ev_out, short msg[8]);
@@ -509,8 +514,7 @@ static void __CDECL on_mbutton_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out
bool ignore=false;
short cur_rel_x, cur_rel_y, dummy, mbut;
- if(tv == NULL)
- return;
+ assert(tv);
gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &work);
slid = gemtk_wm_get_scroll_info(tv->window);
@@ -593,14 +597,14 @@ static void __CDECL on_mbutton_event(ATARI_TREEVIEW_PTR tptr, EVMULT_OUT *ev_out
struct atari_treeview_window *
atari_treeview_create(GUIWIN *win, struct atari_treeview_callbacks * callbacks,
- uint32_t flags)
+ void * user_data, uint32_t flags)
{
/* allocate the core_window struct: */
struct atari_treeview_window * cw;
struct gemtk_wm_scroll_info_s *slid;
- cw = calloc(sizeof(struct atari_treeview_window), 1);
+ cw = calloc(1, sizeof(struct atari_treeview_window));
if (cw == NULL) {
LOG(("calloc failed"));
warn_user(messages_get_errorcode(NSERROR_NOMEM), 0);
@@ -610,6 +614,7 @@ atari_treeview_create(GUIWIN *win, struct atari_treeview_callbacks * callbacks,
/* Store the window ref inside the new treeview: */
cw->window = win;
cw->io = callbacks;
+ cw->user_data = user_data;
// Setup gemtk event handler function:
gemtk_wm_set_event_handler(win, handle_event);
@@ -656,10 +661,24 @@ void atari_treeview_delete(struct atari_treeview_window * cw)
void atari_treeview_open(struct atari_treeview_window *cw, GRECT *pos)
{
- if (cw->window != NULL) {
+ if (cw->window != NULL && cw->is_open == false) {
cw->is_open = true;
wind_open_grect(gemtk_wm_get_handle(cw->window), pos);
gemtk_wm_link(cw->window);
+ if (treeviews_open == NULL) {
+ treeviews_open = cw;
+ treeviews_open->next_open = NULL;
+ treeviews_open->prev_open = NULL;
+ } else {
+ struct atari_treeview_window * tmp;
+ tmp = treeviews_open;
+ while(tmp->next_open != NULL){
+ tmp = tmp->next_open;
+ }
+ tmp->next_open = cw;
+ cw->prev_open = tmp;
+ cw->next_open = NULL;
+ }
}
}
@@ -668,12 +687,33 @@ bool atari_treeview_is_open(struct atari_treeview_window *cw)
return(cw->is_open);
}
+void atari_treeview_set_user_data(struct atari_treeview_window * tv,
+ void *user_data_ptr)
+{
+ tv->user_data = user_data_ptr;
+}
+
+void * atari_treeview_get_user_data(struct atari_treeview_window * tv)
+{
+ return(tv->user_data);
+}
+
void atari_treeview_close(struct atari_treeview_window *cw)
{
if (cw->window != NULL) {
cw->is_open = false;
wind_close(gemtk_wm_get_handle(cw->window));
gemtk_wm_unlink(cw->window);
+ /* unlink the window: */
+ struct atari_treeview_window *tmp = treeviews_open;
+ if (cw->prev_open != NULL) {
+ cw->prev_open->next_open = cw->next_open;
+ } else {
+ treeviews_open = cw->next_open;
+ }
+ if (cw->next_open != NULL) {
+ cw->next_open->prev_open = cw->prev_open;
+ }
}
}
@@ -800,3 +840,20 @@ void atari_treeview_drag_status(struct core_window *cw,
}
+void atari_treeview_flush_redraws(void)
+{
+ struct atari_treeview_window *tmp;
+
+ tmp = treeviews_open;
+
+ if(tmp){
+ while(tmp){
+ assert(tmp->is_open);
+ if(tmp->redraw){
+ atari_treeview_redraw(tmp);
+ }
+ tmp = tmp->next_open;
+ }
+ }
+}
+
diff --git a/atari/treeview.h b/atari/treeview.h
index bab20c4..d9defcc 100644
--- a/atari/treeview.h
+++ b/atari/treeview.h
@@ -60,9 +60,9 @@ struct atari_treeview_callbacks {
gemtk_wm_event_handler_f gemtk_user_func;
};
-struct atari_treeview_window *
-atari_treeview_create(GUIWIN *win, struct atari_treeview_callbacks * callbacks,
- uint32_t flags);
+struct atari_treeview_window * atari_treeview_create(GUIWIN *win,
+ struct atari_treeview_callbacks * callbacks,
+ void * user_data, uint32_t flags);
void atari_treeview_delete(struct atari_treeview_window * cw);
void atari_treeview_open(struct atari_treeview_window * cw, GRECT *pos);
bool atari_treeview_is_open(struct atari_treeview_window *cw);
@@ -71,5 +71,9 @@ GUIWIN * atari_treeview_get_gemtk_window(struct atari_treeview_window *tv);
void atari_treeview_get_grect(ATARI_TREEVIEW_PTR tptr, enum treeview_area_e mode,
GRECT *dest);
void atari_treeview_redraw(struct atari_treeview_window *tv);
+void atari_treeview_set_user_data(struct atari_treeview_window * tv,
+ void *user_data_ptr);
+void *atari_treeview_get_user_data(struct atari_treeview_window * tv);
+void atari_treeview_flush_redraws(void);
#endif //NSATARI_TREEVIEW_H
--
NetSurf Browser
10 years
netsurf: branch mono/atari_treeview_rework updated. release/3.0-576-gff1f5a5
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/ff1f5a5fafd92baf23999...
...commit http://git.netsurf-browser.org/netsurf.git/commit/ff1f5a5fafd92baf2399910...
...tree http://git.netsurf-browser.org/netsurf.git/tree/ff1f5a5fafd92baf239991043...
The branch, mono/atari_treeview_rework has been updated
via ff1f5a5fafd92baf239991043c28935a669765f7 (commit)
from 35b5a5d6cd59b50d47ec29476e72b7c5b506bb10 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=ff1f5a5fafd92baf239...
commit ff1f5a5fafd92baf239991043c28935a669765f7
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
enabled history menu item.
diff --git a/atari/deskmenu.c b/atari/deskmenu.c
index 4084d83..eb1192b 100644
--- a/atari/deskmenu.c
+++ b/atari/deskmenu.c
@@ -462,7 +462,7 @@ static void __CDECL menu_lhistory(short item, short title, void *data)
static void __CDECL menu_ghistory(short item, short title, void *data)
{
LOG(("%s", __FUNCTION__));
- //atari_global_history_open();
+ atari_global_history_open();
}
static void __CDECL menu_add_bookmark(short item, short title, void *data)
-----------------------------------------------------------------------
Summary of changes:
atari/deskmenu.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/atari/deskmenu.c b/atari/deskmenu.c
index 4084d83..eb1192b 100644
--- a/atari/deskmenu.c
+++ b/atari/deskmenu.c
@@ -462,7 +462,7 @@ static void __CDECL menu_lhistory(short item, short title, void *data)
static void __CDECL menu_ghistory(short item, short title, void *data)
{
LOG(("%s", __FUNCTION__));
- //atari_global_history_open();
+ atari_global_history_open();
}
static void __CDECL menu_add_bookmark(short item, short title, void *data)
--
NetSurf Browser
10 years
netsurf: branch mono/atari_treeview_rework updated. release/3.0-575-g35b5a5d
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/35b5a5d6cd59b50d47ec2...
...commit http://git.netsurf-browser.org/netsurf.git/commit/35b5a5d6cd59b50d47ec294...
...tree http://git.netsurf-browser.org/netsurf.git/tree/35b5a5d6cd59b50d47ec29476...
The branch, mono/atari_treeview_rework has been updated
via 35b5a5d6cd59b50d47ec29476e72b7c5b506bb10 (commit)
from 3a5d8cf6c1bbecfaa23e28a8b4b25f380091db30 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=35b5a5d6cd59b50d47e...
commit 35b5a5d6cd59b50d47ec29476e72b7c5b506bb10
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Enabled atari_global_history_destry/init
diff --git a/atari/gui.c b/atari/gui.c
index 33d63b4..c0b8cb2 100644
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -174,16 +174,11 @@ void gui_poll(bool active)
// TODO: implement generic treeview redraw function
// TODO: rename hl to atari_hotlist or create getter for it...
- //atari_treeview_redraw(hl.tv);
+
atari_hotlist_redraw();
atari_cookie_manager_redraw();
atari_global_history_redraw();
-/* // TODO: reenable history redraws
- if(gl_history.tv->redraw){
- atari_treeview_redraw(gl_history.tv);
- }
-*/
}
@@ -840,7 +835,7 @@ void gui_quit(void)
}
/* destroy the treeview windows: */
- //atari_global_history_destroy();
+ atari_global_history_destroy();
atari_hotlist_destroy();
atari_cookie_manager_destroy();
@@ -1061,7 +1056,7 @@ static void gui_init2(int argc, char** argv)
treeview_init(0);
/* Initialize the specific treeview windows: */
- //atari_global_history_init();
+ atari_global_history_init();
atari_hotlist_init();
atari_cookie_manager_init();
-----------------------------------------------------------------------
Summary of changes:
atari/gui.c | 11 +++--------
1 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/atari/gui.c b/atari/gui.c
index 33d63b4..c0b8cb2 100644
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -174,16 +174,11 @@ void gui_poll(bool active)
// TODO: implement generic treeview redraw function
// TODO: rename hl to atari_hotlist or create getter for it...
- //atari_treeview_redraw(hl.tv);
+
atari_hotlist_redraw();
atari_cookie_manager_redraw();
atari_global_history_redraw();
-/* // TODO: reenable history redraws
- if(gl_history.tv->redraw){
- atari_treeview_redraw(gl_history.tv);
- }
-*/
}
@@ -840,7 +835,7 @@ void gui_quit(void)
}
/* destroy the treeview windows: */
- //atari_global_history_destroy();
+ atari_global_history_destroy();
atari_hotlist_destroy();
atari_cookie_manager_destroy();
@@ -1061,7 +1056,7 @@ static void gui_init2(int argc, char** argv)
treeview_init(0);
/* Initialize the specific treeview windows: */
- //atari_global_history_init();
+ atari_global_history_init();
atari_hotlist_init();
atari_cookie_manager_init();
--
NetSurf Browser
10 years