r9520 MarkieB - in /branches/MarkieB/windows: !NetSurf/Resources/de/Messages !NetSurf/Resources/en/Messages !NetSurf/Resources/fr/Messages !NetSurf/Resources/it/Messages !NetSurf/Resources/nl/Messages windows/download.c
by netsurf@semichrome.net
Author: MarkieB
Date: Mon Aug 31 06:20:58 2009
New Revision: 9520
URL: http://source.netsurf-browser.org?rev=9520&view=rev
Log:
add time estimate
Modified:
branches/MarkieB/windows/!NetSurf/Resources/de/Messages
branches/MarkieB/windows/!NetSurf/Resources/en/Messages
branches/MarkieB/windows/!NetSurf/Resources/fr/Messages
branches/MarkieB/windows/!NetSurf/Resources/it/Messages
branches/MarkieB/windows/!NetSurf/Resources/nl/Messages
branches/MarkieB/windows/windows/download.c
Modified: branches/MarkieB/windows/!NetSurf/Resources/de/Messages
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/%21NetSurf/Res...
==============================================================================
--- branches/MarkieB/windows/!NetSurf/Resources/de/Messages (original)
+++ branches/MarkieB/windows/!NetSurf/Resources/de/Messages Mon Aug 31 06:20:58 2009
@@ -384,6 +384,7 @@
UnknownHost:an unknown host
UnknownFile:
UnknownSize:unknown
+FileOpenWriteError:the file %s could not be opened for writing
# Amiga download window tokens
#
Modified: branches/MarkieB/windows/!NetSurf/Resources/en/Messages
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/%21NetSurf/Res...
==============================================================================
--- branches/MarkieB/windows/!NetSurf/Resources/en/Messages (original)
+++ branches/MarkieB/windows/!NetSurf/Resources/en/Messages Mon Aug 31 06:20:58 2009
@@ -384,6 +384,7 @@
UnknownFile:
UnknownSize:unknown
UnknownHost:an unknown host
+FileOpenWriteError:the file %s could not be opened for writing
# Amiga download window tokens
#
Modified: branches/MarkieB/windows/!NetSurf/Resources/fr/Messages
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/%21NetSurf/Res...
==============================================================================
--- branches/MarkieB/windows/!NetSurf/Resources/fr/Messages (original)
+++ branches/MarkieB/windows/!NetSurf/Resources/fr/Messages Mon Aug 31 06:20:58 2009
@@ -384,6 +384,7 @@
UnknownHost:an unknown host
UnknownFile:
UnknownSize:inconnu
+FileOpenWriteError:le fichier %s ne pouvait pas être ouvert pour écriture
# Amiga download window tokens
#
Modified: branches/MarkieB/windows/!NetSurf/Resources/it/Messages
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/%21NetSurf/Res...
==============================================================================
--- branches/MarkieB/windows/!NetSurf/Resources/it/Messages (original)
+++ branches/MarkieB/windows/!NetSurf/Resources/it/Messages Mon Aug 31 06:20:58 2009
@@ -386,6 +386,7 @@
UnknownHost:un Host sconosciuto
UnknownFile:
UnknownSize:sconosciuto
+FileOpenWriteError:the file %s could not be opened for writing
# Amiga download window tokens
#
Modified: branches/MarkieB/windows/!NetSurf/Resources/nl/Messages
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/%21NetSurf/Res...
==============================================================================
--- branches/MarkieB/windows/!NetSurf/Resources/nl/Messages (original)
+++ branches/MarkieB/windows/!NetSurf/Resources/nl/Messages Mon Aug 31 06:20:58 2009
@@ -384,6 +384,7 @@
UnknownHost:an unknown host
UnknownFile:
UnknownSize:unknown
+FileOpenWriteError:the file %s could not be opened for writing
# Amiga download window tokens
#
Modified: branches/MarkieB/windows/windows/download.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/downlo...
==============================================================================
--- branches/MarkieB/windows/windows/download.c (original)
+++ branches/MarkieB/windows/windows/download.c Mon Aug 31 06:20:58 2009
@@ -54,6 +54,10 @@
downloading = true;
struct gui_download_window *w =
malloc(sizeof(struct gui_download_window));
+ if (w == NULL) {
+ warn_user(messages_get("NoMemory"), 0);
+ return NULL;
+ }
char *domain, *filename, *destination;
bool unknown_size = (total_size == 0);
const char *size = (unknown_size) ?
@@ -62,10 +66,27 @@
if (url_nice(url, &filename, false) != URL_FUNC_OK)
filename = strdup(messages_get("UnknownFile"));
+ if (filename == NULL) {
+ warn_user(messages_get("NoMemory"), 0);
+ free(w);
+ return NULL;
+ }
if (url_host(url, &domain) != URL_FUNC_OK)
domain = strdup(messages_get("UnknownHost"));
-
+ if (domain == NULL) {
+ warn_user(messages_get("NoMemory"), 0);
+ free(filename);
+ free(w);
+ return NULL;
+ }
destination = malloc(PATH_MAX);
+ if (destination == NULL) {
+ warn_user(messages_get("NoMemory"), 0);
+ free(domain);
+ free(filename);
+ free(w);
+ return NULL;
+ }
SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, SHGFP_TYPE_CURRENT,
destination);
if (strlen(destination) < PATH_MAX - 2)
@@ -77,22 +98,37 @@
w->fetch = fetch;
w->title = filename;
w->domain = domain;
- w->time_left = strdup("");
w->size = total_size;
w->total_size = strdup(size);
+ if (w->total_size == NULL) {
+ warn_user(messages_get("NoMemory"), 0);
+ free(destination);
+ free(domain);
+ free(filename);
+ free(w);
+ return NULL;
+ }
w->downloaded = 0;
w->speed = 0;
gettimeofday(&(w->start_time), NULL);
w->time_remaining = -1;
+ w->time_left = NULL;
w->status = DOWNLOAD_NONE;
w->filename = destination;
w->progress = 0;
w->error = 0;
w->window = gui;
w->file = fopen(destination, "wb");
- if (w->file == NULL)
- warn_user("couldn't open destination file for writing", 0);
-
+ if (w->file == NULL) {
+ warn_user(messages_get("FileOpenWriteError"), destination);
+ free(destination);
+ free(domain);
+ free(filename);
+ free(w->total_size);
+ free(w->time_left);
+ free(w);
+ return NULL;
+ }
download1 = w;
nsws_download_window_up(w);
@@ -148,11 +184,30 @@
}
HWND sub = GetDlgItem(w->hwnd, NSWS_ID_DOWNLOAD_LABEL);
char *size = human_friendly_bytesize(w->downloaded);
+ int i = 0, temp = w->time_remaining;
+ if (temp == -1) {
+ w->time_left = strdup("unknown");
+ i = SLEN("unknown");
+ } else {
+ do {
+ temp = temp / 10;
+ i++;
+ } while (temp > 2);
+ w->time_left = malloc(i + SLEN(" s") + 1);
+ if (w->time_left != NULL)
+ sprintf(w->time_left, "%d s", w->time_remaining);
+ }
char label[strlen(w->title) + strlen(size) + strlen(w->total_size) +
+ strlen(w->domain) + strlen(w->filename) +
- SLEN("download from to \n[\t/\t]") + 1];
- sprintf(label, "download %s from %s to %s\n[%s\t/\t%s]", w->title,
- w->domain, w->filename, size, w->total_size);
+ SLEN("download from to \n[\t/\t]\n estimate of time"
+ " remaining ") + i + 1];
+ sprintf(label, "download %s from %s to %s\n[%s\t/\t%s]\n estimate of "
+ "time remaining %s", w->title, w->domain, w->filename,
+ size, w->total_size, w->time_left);
+ if (w->time_left != NULL) {
+ free(w->time_left);
+ w->time_left = NULL;
+ }
SendMessage(sub, WM_SETTEXT, (WPARAM)0, (LPARAM)label);
if (w->progress < 100)
schedule(50, nsws_download_update_label, p);
@@ -198,11 +253,16 @@
if ((w == NULL) || (w->file == NULL))
return;
size_t res;
+ struct timeval val;
res = fwrite((void *)data, 1, size, w->file);
if (res != size)
LOG(("file write error %d of %d", size - res, size));
- w->downloaded += size;
+ w->downloaded += res;
w->progress = (w->downloaded * 100) / w->size;
+ gettimeofday(&val, NULL);
+ w->time_remaining = (w->progress == 0) ? -1 :
+ (val.tv_sec - w->start_time.tv_sec) *
+ (100 - w->progress) / w->progress;
}
void gui_download_window_error(struct gui_download_window *w,
14 years, 3 months
r9519 tlsa - /trunk/netsurf/render/layout.c
by netsurf@semichrome.net
Author: tlsa
Date: Mon Aug 31 05:44:40 2009
New Revision: 9519
URL: http://source.netsurf-browser.org?rev=9519&view=rev
Log:
Clearer wrapping.
Modified:
trunk/netsurf/render/layout.c
Modified: trunk/netsurf/render/layout.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/layout.c?rev=9519&...
==============================================================================
--- trunk/netsurf/render/layout.c (original)
+++ trunk/netsurf/render/layout.c Mon Aug 31 05:44:40 2009
@@ -3849,8 +3849,8 @@
css_computed_position(box->style) ==
CSS_POSITION_RELATIVE);
- if (box->float_container && (css_computed_float(box->style) ==
- CSS_FLOAT_LEFT ||
+ if (box->float_container &&
+ (css_computed_float(box->style) == CSS_FLOAT_LEFT ||
css_computed_float(box->style) == CSS_FLOAT_RIGHT)) {
containing_block = box->float_container;
} else {
14 years, 3 months
r9518 tlsa - /trunk/netsurf/render/layout.c
by netsurf@semichrome.net
Author: tlsa
Date: Mon Aug 31 05:39:32 2009
New Revision: 9518
URL: http://source.netsurf-browser.org?rev=9518&view=rev
Log:
Simplification of relative offset calculation. Thanks to Christopher Martin.
Modified:
trunk/netsurf/render/layout.c
Modified: trunk/netsurf/render/layout.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/layout.c?rev=9518&...
==============================================================================
--- trunk/netsurf/render/layout.c (original)
+++ trunk/netsurf/render/layout.c Mon Aug 31 05:39:32 2009
@@ -70,7 +70,7 @@
struct box *box);
static bool layout_apply_minmax_height(struct box *box, struct box *container);
static void layout_block_add_scrollbar(struct box *box, int which);
-static int layout_solve_width(struct box *box, int available_width, int width,
+static int layout_solve_width(struct box *box, int available_width, int width,
int lm, int rm, int max_width, int min_width);
static void layout_float_find_dimensions(int available_width,
const css_computed_style *style, struct box *box);
@@ -1024,16 +1024,16 @@
* \post \a box's left/right margins will be updated.
*/
-int layout_solve_width(struct box *box, int available_width, int width,
+int layout_solve_width(struct box *box, int available_width, int width,
int lm, int rm, int max_width, int min_width)
{
bool auto_width = false;
/* Increase specified left/right margins */
- if (box->margin[LEFT] != AUTO && box->margin[LEFT] < lm &&
+ if (box->margin[LEFT] != AUTO && box->margin[LEFT] < lm &&
box->margin[LEFT] >= 0)
box->margin[LEFT] = lm;
- if (box->margin[RIGHT] != AUTO && box->margin[RIGHT] < rm &&
+ if (box->margin[RIGHT] != AUTO && box->margin[RIGHT] < rm &&
box->margin[RIGHT] >= 0)
box->margin[RIGHT] = rm;
@@ -1095,10 +1095,10 @@
if (box->margin[LEFT] == AUTO && box->margin[RIGHT] == AUTO) {
/* make the margins equal, centering the element */
- box->margin[LEFT] = box->margin[RIGHT] =
+ box->margin[LEFT] = box->margin[RIGHT] =
(available_width - lm - rm -
- (box->border[LEFT].width + box->padding[LEFT] +
- width + box->padding[RIGHT] +
+ (box->border[LEFT].width + box->padding[LEFT] +
+ width + box->padding[RIGHT] +
box->border[RIGHT].width)) / 2;
if (box->margin[LEFT] < 0) {
@@ -1110,17 +1110,17 @@
} else if (box->margin[LEFT] == AUTO) {
box->margin[LEFT] = available_width - lm -
- (box->border[LEFT].width + box->padding[LEFT] +
- width + box->padding[RIGHT] +
+ (box->border[LEFT].width + box->padding[LEFT] +
+ width + box->padding[RIGHT] +
box->border[RIGHT].width + box->margin[RIGHT]);
- box->margin[LEFT] = box->margin[LEFT] < lm
+ box->margin[LEFT] = box->margin[LEFT] < lm
? lm : box->margin[LEFT];
} else {
/* margin-right auto or "over-constrained" */
box->margin[RIGHT] = available_width - rm -
(box->margin[LEFT] + box->border[LEFT].width +
- box->padding[LEFT] + width +
- box->padding[RIGHT] +
+ box->padding[LEFT] + width +
+ box->padding[RIGHT] +
box->border[RIGHT].width);
}
@@ -2677,7 +2677,7 @@
b->width = opt_maxwidth;
if (option_core_select_menu)
b->width += SCROLLBAR_WIDTH;
-
+
} else {
font_func->font_width(&fstyle, b->text,
b->length, &b->width);
@@ -3871,19 +3871,14 @@
else {
/* over constrained => examine direction property
* of containing block */
- if (containing_block->style) {
- if (css_computed_direction(containing_block->style) ==
- CSS_DIRECTION_LTR)
- /* left wins */
- right = -left;
- else if (css_computed_direction(
- containing_block->style) ==
- CSS_DIRECTION_RTL)
- /* right wins */
- left = -right;
- }
- else {
- /* no parent style, so assume LTR */
+ if (containing_block->style &&
+ css_computed_direction(
+ containing_block->style) ==
+ CSS_DIRECTION_RTL) {
+ /* right wins */
+ left = -right;
+ } else {
+ /* assume LTR in all other cases */
right = -left;
}
}
@@ -4226,7 +4221,7 @@
/* \todo layout_table considers margins etc. again */
if (!layout_table(box, width, content))
return false;
- layout_solve_width(box, box->parent->width, box->width, 0, 0,
+ layout_solve_width(box, box->parent->width, box->width, 0, 0,
-1, -1);
}
14 years, 3 months
r9517 MarkieB - in /branches/MarkieB/windows/windows: download.c schedule.c
by netsurf@semichrome.net
Author: MarkieB
Date: Mon Aug 31 05:36:37 2009
New Revision: 9517
URL: http://source.netsurf-browser.org?rev=9517&view=rev
Log:
nicer update frequency for download progress
Modified:
branches/MarkieB/windows/windows/download.c
branches/MarkieB/windows/windows/schedule.c
Modified: branches/MarkieB/windows/windows/download.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/downlo...
==============================================================================
--- branches/MarkieB/windows/windows/download.c (original)
+++ branches/MarkieB/windows/windows/download.c Mon Aug 31 05:36:37 2009
@@ -38,10 +38,8 @@
static bool nsws_download_window_up(struct gui_download_window *w);
BOOL CALLBACK nsws_download_event_callback(HWND hwnd, UINT msg, WPARAM wparam,
LPARAM lparam);
-static void nsws_download_update_label(HWND hwnd,
- struct gui_download_window *w);
-static void nsws_download_update_progress(HWND hwnd,
- struct gui_download_window *w);
+static void nsws_download_update_label(void *p);
+static void nsws_download_update_progress(void *p);
static void nsws_download_clear_data(struct gui_download_window *w);
struct gui_download_window *gui_download_window_create(const char *url,
@@ -81,8 +79,7 @@
w->domain = domain;
w->time_left = strdup("");
w->size = total_size;
- w->total_size = (char *)size;
- w->original_total_size = strdup(size);
+ w->total_size = strdup(size);
w->downloaded = 0;
w->speed = 0;
gettimeofday(&(w->start_time), NULL);
@@ -123,7 +120,8 @@
switch(msg){
case WM_INITDIALOG:
sub = GetDlgItem(hwnd, NSWS_ID_DOWNLOAD_LABEL);
- nsws_download_update_label(sub, download1);
+ nsws_download_update_label((void *)download1);
+ nsws_download_update_progress((void *)download1);
return TRUE;
case WM_COMMAND:
switch(LOWORD(wparam)) {
@@ -141,21 +139,36 @@
return FALSE;
}
-void nsws_download_update_label(HWND hwnd, struct gui_download_window *w)
-{
- char label[strlen(w->title) + strlen(w->total_size) +
- strlen(w->original_total_size) + strlen(w->domain)
- + strlen(w->filename) +
+void nsws_download_update_label(void *p)
+{
+ struct gui_download_window *w = p;
+ if (w->hwnd == NULL) {
+ schedule_remove(nsws_download_update_label, p);
+ return;
+ }
+ HWND sub = GetDlgItem(w->hwnd, NSWS_ID_DOWNLOAD_LABEL);
+ char *size = human_friendly_bytesize(w->downloaded);
+ char label[strlen(w->title) + strlen(size) + strlen(w->total_size) +
+ + strlen(w->domain) + strlen(w->filename) +
SLEN("download from to \n[\t/\t]") + 1];
sprintf(label, "download %s from %s to %s\n[%s\t/\t%s]", w->title,
- w->domain, w->filename, w->total_size,
- w->original_total_size);
- SendMessage(hwnd, WM_SETTEXT, (WPARAM)0, (LPARAM)label);
-}
-
-void nsws_download_update_progress(HWND hwnd, struct gui_download_window *w)
-{
- SendMessage(hwnd, PBM_SETPOS, (WPARAM)w->progress, 0);
+ w->domain, w->filename, size, w->total_size);
+ SendMessage(sub, WM_SETTEXT, (WPARAM)0, (LPARAM)label);
+ if (w->progress < 100)
+ schedule(50, nsws_download_update_label, p);
+}
+
+void nsws_download_update_progress(void *p)
+{
+ struct gui_download_window *w = p;
+ if (w->hwnd == NULL) {
+ schedule_remove(nsws_download_update_progress, p);
+ return;
+ }
+ HWND sub = GetDlgItem(w->hwnd, NSWS_ID_DOWNLOAD_PROGRESS);
+ SendMessage(sub, PBM_SETPOS, (WPARAM)w->progress, 0);
+ if (w->progress < 100)
+ schedule(50, nsws_download_update_progress, p);
}
void nsws_download_clear_data(struct gui_download_window *w)
@@ -174,6 +187,8 @@
free(w->total_size);
if (w->file != NULL)
fclose(w->file);
+ schedule_remove(nsws_download_update_progress, (void *)w);
+ schedule_remove(nsws_download_update_label, (void *)w);
}
@@ -183,16 +198,11 @@
if ((w == NULL) || (w->file == NULL))
return;
size_t res;
- HWND sub;
res = fwrite((void *)data, 1, size, w->file);
if (res != size)
LOG(("file write error %d of %d", size - res, size));
w->downloaded += size;
w->progress = (w->downloaded * 100) / w->size;
- sub = GetDlgItem(w->hwnd, NSWS_ID_DOWNLOAD_LABEL);
- nsws_download_update_label(sub, w);
- sub = GetDlgItem(w->hwnd, NSWS_ID_DOWNLOAD_PROGRESS);
- nsws_download_update_progress(sub, w);
}
void gui_download_window_error(struct gui_download_window *w,
Modified: branches/MarkieB/windows/windows/schedule.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/schedu...
==============================================================================
--- branches/MarkieB/windows/windows/schedule.c (original)
+++ branches/MarkieB/windows/windows/schedule.c Mon Aug 31 05:36:37 2009
@@ -194,10 +194,3 @@
cur_nscb = cur_nscb->next;
}
}
-
-
-/*
- * Local Variables:
- * c-basic-offset:8
- * End:
- */
14 years, 3 months
r9516 chris_y - /trunk/netsurf/amiga/gui.c
by netsurf@semichrome.net
Author: chris_y
Date: Mon Aug 31 05:16:23 2009
New Revision: 9516
URL: http://source.netsurf-browser.org?rev=9516&view=rev
Log:
Increase mouse wheel scroll speed again. This should bring it up to the same speed as
OS4's built-in stuff.
Modified:
trunk/netsurf/amiga/gui.c
Modified: trunk/netsurf/amiga/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.c?rev=9516&r1=9...
==============================================================================
--- trunk/netsurf/amiga/gui.c (original)
+++ trunk/netsurf/amiga/gui.c Mon Aug 31 05:16:23 2009
@@ -3224,8 +3224,8 @@
wheel = (struct IntuiWheelData *)msg->IAddress;
gui_window_set_scroll(gwin->bw->window,
- gwin->bw->window->scrollx + (wheel->WheelX * 20),
- gwin->bw->window->scrolly + (wheel->WheelY * 20));
+ gwin->bw->window->scrollx + (wheel->WheelX * 50),
+ gwin->bw->window->scrolly + (wheel->WheelY * 50));
}
break;
14 years, 3 months
r9515 MarkieB - in /branches/MarkieB/windows/windows: download.c download.h res/resource.o res/resource.rc
by netsurf@semichrome.net
Author: MarkieB
Date: Mon Aug 31 04:57:57 2009
New Revision: 9515
URL: http://source.netsurf-browser.org?rev=9515&view=rev
Log:
basic working download
Modified:
branches/MarkieB/windows/windows/download.c
branches/MarkieB/windows/windows/download.h
branches/MarkieB/windows/windows/res/resource.o
branches/MarkieB/windows/windows/res/resource.rc
Modified: branches/MarkieB/windows/windows/download.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/downlo...
==============================================================================
--- branches/MarkieB/windows/windows/download.c (original)
+++ branches/MarkieB/windows/windows/download.c Mon Aug 31 04:57:57 2009
@@ -29,13 +29,20 @@
#include "utils/utils.h"
#include "utils/win32.h"
#include "windows/download.h"
+#include "windows/gui.h"
#include "windows/windows.h"
static bool downloading = false;
+static struct gui_download_window *download1;
static bool nsws_download_window_up(struct gui_download_window *w);
BOOL CALLBACK nsws_download_event_callback(HWND hwnd, UINT msg, WPARAM wparam,
LPARAM lparam);
+static void nsws_download_update_label(HWND hwnd,
+ struct gui_download_window *w);
+static void nsws_download_update_progress(HWND hwnd,
+ struct gui_download_window *w);
+static void nsws_download_clear_data(struct gui_download_window *w);
struct gui_download_window *gui_download_window_create(const char *url,
const char *mime_type, struct fetch *fetch,
@@ -63,6 +70,10 @@
destination = malloc(PATH_MAX);
SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, SHGFP_TYPE_CURRENT,
destination);
+ if (strlen(destination) < PATH_MAX - 2)
+ strcat(destination, "/");
+ if (strlen(destination) + strlen(filename) < PATH_MAX - 1)
+ strcat(destination, filename);
LOG(("download %s [%s] from %s to %s", filename, size, domain,
destination));
w->fetch = fetch;
@@ -70,52 +81,133 @@
w->domain = domain;
w->time_left = strdup("");
w->size = total_size;
+ w->total_size = (char *)size;
+ w->original_total_size = strdup(size);
w->downloaded = 0;
w->speed = 0;
gettimeofday(&(w->start_time), NULL);
w->time_remaining = -1;
w->status = DOWNLOAD_NONE;
- w->filename = strdup(destination);
+ w->filename = destination;
w->progress = 0;
w->error = 0;
-
- free(destination);
+ w->window = gui;
+ w->file = fopen(destination, "wb");
+ if (w->file == NULL)
+ warn_user("couldn't open destination file for writing", 0);
+
+ download1 = w;
+
nsws_download_window_up(w);
return w;
}
bool nsws_download_window_up(struct gui_download_window *w)
{
- int ret = DialogBox(hinstance, MAKEINTRESOURCE(NSWS_ID_DOWNLOAD_DIALOG),
- NULL, nsws_download_event_callback);
- if (ret == -1) {
+ w->hwnd = CreateDialog(hinstance, MAKEINTRESOURCE(
+ NSWS_ID_DOWNLOAD_DIALOG),
+ gui_window_main_window(w->window),
+ nsws_download_event_callback);
+ if (w->hwnd == NULL) {
warn_user(messages_get("NoMemory"), 0);
return false;
}
+ ShowWindow(w->hwnd, SW_SHOW);
return true;
}
BOOL CALLBACK nsws_download_event_callback(HWND hwnd, UINT msg, WPARAM wparam,
LPARAM lparam)
{
+ HWND sub;
+ switch(msg){
+ case WM_INITDIALOG:
+ sub = GetDlgItem(hwnd, NSWS_ID_DOWNLOAD_LABEL);
+ nsws_download_update_label(sub, download1);
+ return TRUE;
+ case WM_COMMAND:
+ switch(LOWORD(wparam)) {
+ case IDOK:
+ if (download1->downloaded != download1->size)
+ return TRUE;
+ case IDCANCEL:
+ nsws_download_clear_data(download1);
+ download1 = NULL;
+ downloading = false;
+ EndDialog(hwnd, IDCANCEL);
+ return FALSE;
+ }
+ }
return FALSE;
}
+
+void nsws_download_update_label(HWND hwnd, struct gui_download_window *w)
+{
+ char label[strlen(w->title) + strlen(w->total_size) +
+ strlen(w->original_total_size) + strlen(w->domain)
+ + strlen(w->filename) +
+ SLEN("download from to \n[\t/\t]") + 1];
+ sprintf(label, "download %s from %s to %s\n[%s\t/\t%s]", w->title,
+ w->domain, w->filename, w->total_size,
+ w->original_total_size);
+ SendMessage(hwnd, WM_SETTEXT, (WPARAM)0, (LPARAM)label);
+}
+
+void nsws_download_update_progress(HWND hwnd, struct gui_download_window *w)
+{
+ SendMessage(hwnd, PBM_SETPOS, (WPARAM)w->progress, 0);
+}
+
+void nsws_download_clear_data(struct gui_download_window *w)
+{
+ if (w == NULL)
+ return;
+ if (w->title != NULL)
+ free(w->title);
+ if (w->filename != NULL)
+ free(w->filename);
+ if (w->domain != NULL)
+ free(w->domain);
+ if (w->time_left != NULL)
+ free(w->time_left);
+ if (w->total_size != NULL)
+ free(w->total_size);
+ if (w->file != NULL)
+ fclose(w->file);
+}
+
void gui_download_window_data(struct gui_download_window *w, const char *data,
unsigned int size)
{
-
+ if ((w == NULL) || (w->file == NULL))
+ return;
+ size_t res;
+ HWND sub;
+ res = fwrite((void *)data, 1, size, w->file);
+ if (res != size)
+ LOG(("file write error %d of %d", size - res, size));
+ w->downloaded += size;
+ w->progress = (w->downloaded * 100) / w->size;
+ sub = GetDlgItem(w->hwnd, NSWS_ID_DOWNLOAD_LABEL);
+ nsws_download_update_label(sub, w);
+ sub = GetDlgItem(w->hwnd, NSWS_ID_DOWNLOAD_PROGRESS);
+ nsws_download_update_progress(sub, w);
}
void gui_download_window_error(struct gui_download_window *w,
const char *error_msg)
{
-
+ LOG(("error %s", error_msg));
}
void gui_download_window_done(struct gui_download_window *w)
{
+ if (w == NULL)
+ return;
downloading = false;
- DestroyWindow(w->hwnd);
-}
-
+ if (w->hwnd != NULL)
+ EndDialog(w->hwnd, IDOK);
+ nsws_download_clear_data(w);
+}
+
Modified: branches/MarkieB/windows/windows/download.h
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/downlo...
==============================================================================
--- branches/MarkieB/windows/windows/download.h (original)
+++ branches/MarkieB/windows/windows/download.h Mon Aug 31 04:57:57 2009
@@ -29,6 +29,8 @@
char *filename;
char *domain;
char *time_left;
+ char *total_size;
+ char *original_total_size;
int size;
int downloaded;
int progress;
@@ -38,6 +40,7 @@
int error;
struct fetch *fetch;
struct gui_window *window;
+ FILE *file;
download_status status;
};
Modified: branches/MarkieB/windows/windows/res/resource.o
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/res/re...
==============================================================================
Binary files - no diff available.
Modified: branches/MarkieB/windows/windows/res/resource.rc
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/res/re...
==============================================================================
--- branches/MarkieB/windows/windows/res/resource.rc (original)
+++ branches/MarkieB/windows/windows/res/resource.rc Mon Aug 31 04:57:57 2009
@@ -111,7 +111,7 @@
CTEXT
"downloading [file] [size] from [domain] to [destination]",
- NSWS_ID_DOWNLOAD_LABEL,6,6,189,20
+ NSWS_ID_DOWNLOAD_LABEL,6,6,189,35
CONTROL "progress",NSWS_ID_DOWNLOAD_PROGRESS,PROGRESS_CLASS,
- 0,6,35,189,30
+ 0,6,50,189,10
END
14 years, 3 months
r9514 chris_y - /trunk/netsurf/amiga/gui.c
by netsurf@semichrome.net
Author: chris_y
Date: Sun Aug 30 17:05:09 2009
New Revision: 9514
URL: http://source.netsurf-browser.org?rev=9514&view=rev
Log:
Fix scroll position
Modified:
trunk/netsurf/amiga/gui.c
Modified: trunk/netsurf/amiga/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.c?rev=9514&r1=9...
==============================================================================
--- trunk/netsurf/amiga/gui.c (original)
+++ trunk/netsurf/amiga/gui.c Sun Aug 30 17:05:09 2009
@@ -2637,21 +2637,21 @@
{
RefreshSetGadgetAttrs((APTR)g->shared->objects[OID_VSCROLL],
g->shared->win, NULL,
- SCROLLER_Top, sy * g->shared->bw->scale,
+ SCROLLER_Top, (ULONG)(sy * g->shared->bw->scale),
TAG_DONE);
if(g->shared->gadgets[GID_HSCROLL])
{
RefreshSetGadgetAttrs((APTR)g->shared->gadgets[GID_HSCROLL],
g->shared->win, NULL,
- PGA_Top, sx * g->shared->bw->scale,
+ PGA_Top, (ULONG)(sx * g->shared->bw->scale),
TAG_DONE);
}
else if(g->shared->objects[OID_HSCROLL])
{
RefreshSetGadgetAttrs((APTR)g->shared->objects[OID_HSCROLL],
g->shared->win, NULL,
- SCROLLER_Top, sx * g->shared->bw->scale,
+ SCROLLER_Top, (ULONG)(sx * g->shared->bw->scale),
TAG_DONE);
}
g->shared->redraw_required = true;
14 years, 3 months
r9513 chris_y - in /trunk/netsurf: !NetSurf/Resources/de/Messages !NetSurf/Resources/en/Messages !NetSurf/Resources/fr/Messages !NetSurf/Resources/it/Messages !NetSurf/Resources/nl/Messages amiga/gui.c amiga/menu.c amiga/menu.h
by netsurf@semichrome.net
Author: chris_y
Date: Sun Aug 30 16:43:14 2009
New Revision: 9513
URL: http://source.netsurf-browser.org?rev=9513&view=rev
Log:
Mostly working scale. Fast scrolling doesn't work when scaled, and neither does
updating boxes (GIF anims etc)
Modified:
trunk/netsurf/!NetSurf/Resources/de/Messages
trunk/netsurf/!NetSurf/Resources/en/Messages
trunk/netsurf/!NetSurf/Resources/fr/Messages
trunk/netsurf/!NetSurf/Resources/it/Messages
trunk/netsurf/!NetSurf/Resources/nl/Messages
trunk/netsurf/amiga/gui.c
trunk/netsurf/amiga/menu.c
trunk/netsurf/amiga/menu.h
Modified: trunk/netsurf/!NetSurf/Resources/de/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/de/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/de/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/de/Messages Sun Aug 30 16:43:14 2009
@@ -264,6 +264,9 @@
HistLocalNS:Show local history...
FindTextNS:Find text...
Redraw:Redraw page
+ScaleInc:Increase
+ScaleDec:Decrease
+ScaleNorm:Normal
# Hotlist menu
#
Modified: trunk/netsurf/!NetSurf/Resources/en/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/en/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/en/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/en/Messages Sun Aug 30 16:43:14 2009
@@ -264,6 +264,9 @@
HistLocalNS:Show local history...
FindTextNS:Find text...
Redraw:Redraw page
+ScaleInc:Increase
+ScaleDec:Decrease
+ScaleNorm:Normal
# Hotlist menu
#
Modified: trunk/netsurf/!NetSurf/Resources/fr/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/fr/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/fr/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/fr/Messages Sun Aug 30 16:43:14 2009
@@ -264,6 +264,9 @@
HistLocalNS:Show local history...
FindTextNS:Find text...
Redraw:Redraw page
+ScaleInc:Increase
+ScaleDec:Decrease
+ScaleNorm:Normal
# Hotlist menu
#
Modified: trunk/netsurf/!NetSurf/Resources/it/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/it/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/it/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/it/Messages Sun Aug 30 16:43:14 2009
@@ -266,6 +266,9 @@
HistLocalNS:Mostra cronologia locale...
FindTextNS:Trova testo...
Redraw:Ridisegna pagina
+ScaleInc:Increase
+ScaleDec:Decrease
+ScaleNorm:Normal
# Hotlist menu
#
Modified: trunk/netsurf/!NetSurf/Resources/nl/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/nl/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/nl/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/nl/Messages Sun Aug 30 16:43:14 2009
@@ -264,6 +264,9 @@
HistLocalNS:Show local history...
FindTextNS:Find text...
Redraw:Redraw page
+ScaleInc:Increase
+ScaleDec:Decrease
+ScaleNorm:Normal
# Hotlist menu
#
Modified: trunk/netsurf/amiga/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.c?rev=9513&r1=9...
==============================================================================
--- trunk/netsurf/amiga/gui.c (original)
+++ trunk/netsurf/amiga/gui.c Sun Aug 30 16:43:14 2009
@@ -77,6 +77,7 @@
#include <graphics/blitattr.h>
#include "amiga/gui_options.h"
#include "amiga/bitmap.h"
+#include "amiga/print.h"
#include "amiga/stringview/stringview.h"
#include "amiga/stringview/urlhistory.h"
@@ -189,6 +190,7 @@
void ami_switch_tab(struct gui_window_2 *gwin,bool redraw);
static void *myrealloc(void *ptr, size_t len, void *pw);
void ami_get_hscroll_pos(struct gui_window_2 *gwin, ULONG *xs);
+void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys);
ULONG ami_set_border_gadget_balance(struct gui_window_2 *gwin);
ULONG ami_get_border_gadget_balance(struct gui_window_2 *gwin, ULONG *size1, ULONG *size2);
@@ -812,14 +814,17 @@
case WMHI_MOUSEMOVE:
GetAttr(SPACE_AreaBox,gwin->gadgets[GID_BROWSER],(ULONG *)&bbox);
- ami_get_hscroll_pos(gwin, (ULONG *)&xs);
- x = gwin->win->MouseX - bbox->Left +xs; // mousex should be in intuimessage
-
- GetAttr(SCROLLER_Top,gwin->objects[OID_VSCROLL],(ULONG *)&ys);
- y = gwin->win->MouseY - bbox->Top + ys;
+ x = gwin->win->MouseX - bbox->Left; // mousex should be in intuimessage
+ y = gwin->win->MouseY - bbox->Top;
x /= gwin->bw->scale;
y /= gwin->bw->scale;
+
+ ami_get_hscroll_pos(gwin, (ULONG *)&xs);
+ ami_get_vscroll_pos(gwin, (ULONG *)&ys);
+
+ x += xs;
+ y += ys;
width=bbox->Width;
height=bbox->Height;
@@ -862,14 +867,19 @@
break;
case WMHI_MOUSEBUTTONS:
- GetAttr(SPACE_AreaBox,gwin->gadgets[GID_BROWSER],(ULONG *)&bbox);
- ami_get_hscroll_pos(gwin, (ULONG *)&xs);
- x = gwin->win->MouseX - bbox->Left +xs;
- GetAttr(SCROLLER_Top,gwin->objects[OID_VSCROLL],(ULONG *)&ys);
- y = gwin->win->MouseY - bbox->Top + ys;
+ GetAttr(SPACE_AreaBox,gwin->gadgets[GID_BROWSER],(ULONG *)&bbox);
+
+ x = gwin->win->MouseX - bbox->Left;
+ y = gwin->win->MouseY - bbox->Top;
x /= gwin->bw->scale;
y /= gwin->bw->scale;
+
+ ami_get_hscroll_pos(gwin, (ULONG *)&xs);
+ ami_get_vscroll_pos(gwin, (ULONG *)&ys);
+
+ x += xs;
+ y += ys;
width=bbox->Width;
height=bbox->Height;
@@ -1298,7 +1308,7 @@
ami_get_hscroll_pos(gwin, (ULONG *)&xs);
x = (appmsg->am_MouseX) - (bbox->Left) +xs;
- GetAttr(SCROLLER_Top,gwin->objects[OID_VSCROLL],(ULONG *)&ys);
+ ami_get_vscroll_pos(gwin, (ULONG *)&ys);
y = appmsg->am_MouseY - bbox->Top + ys;
width=bbox->Width;
@@ -2434,7 +2444,7 @@
c = g->shared->bw->current_content;
ami_get_hscroll_pos(g->shared, (ULONG *)&sx);
- GetAttr(SCROLLER_Top,g->shared->objects[OID_VSCROLL],(ULONG *)&sy);
+ ami_get_vscroll_pos(g->shared, (ULONG *)&sy);
ami_do_redraw_limits(g,c,x0,y0,x1,y1,sx,sy);
}
@@ -2459,7 +2469,7 @@
if(!g) return;
ami_get_hscroll_pos(g->shared, (ULONG *)&sx);
- GetAttr(SCROLLER_Top,g->shared->objects[OID_VSCROLL],(ULONG *)&sy);
+ ami_get_vscroll_pos(g->shared, (ULONG *)&sy);
ami_do_redraw_limits(g,g->shared->bw->current_content,
data->redraw.x,data->redraw.y,
@@ -2480,7 +2490,7 @@
GetAttr(SPACE_AreaBox,g->gadgets[GID_BROWSER],(ULONG *)&bbox);
ami_get_hscroll_pos(g, (ULONG *)&hcurrent);
- GetAttr(SCROLLER_Top,g->objects[OID_VSCROLL],(ULONG *)&vcurrent);
+ ami_get_vscroll_pos(g, (ULONG *)&vcurrent);
c = g->bw->current_content;
@@ -2548,20 +2558,20 @@
if(c->type == CONTENT_HTML)
{
+ content_redraw(c, -hcurrent,
+ -vcurrent,
+ (width / g->bw->scale) - hcurrent,
+ (height / g->bw->scale) - vcurrent,
+ 0,0,width,
+ height,
+ g->bw->scale,0xFFFFFF);
+ }
+ else
+ {
content_redraw(c, -hcurrent /* * g->bw->scale */,
-vcurrent /* * g->bw->scale */,
- width-hcurrent /* * g->bw->scale */,
- height-vcurrent /* * g->bw->scale */,
- 0,0,width /* * g->bw->scale */,
- height /* * g->bw->scale */,
- g->bw->scale,0xFFFFFF);
- }
- else
- {
- content_redraw(c, -hcurrent /* * g->bw->scale */,
- -vcurrent /* * g->bw->scale */,
- width-hcurrent /* * g->bw->scale */,
- height-vcurrent /* * g->bw->scale */,
+ (width / g->bw->scale) - hcurrent,
+ (height / g->bw->scale) - vcurrent,
0,0,c->width /* * g->bw->scale */,
c->height /* * g->bw->scale */,
g->bw->scale,0xFFFFFF);
@@ -2594,12 +2604,20 @@
{
GetAttr(SCROLLER_Top, gwin->objects[OID_HSCROLL], xs);
}
+
+ *xs /= gwin->bw->scale;
+}
+
+void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys)
+{
+ GetAttr(SCROLLER_Top, gwin->objects[OID_VSCROLL], ys);
+ *ys /= gwin->bw->scale;
}
bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
{
ami_get_hscroll_pos(g->shared, (ULONG *)sx);
- GetAttr(SCROLLER_Top,g->shared->objects[OID_VSCROLL],(ULONG *)sy);
+ ami_get_vscroll_pos(g->shared, (ULONG *)sy);
}
void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
@@ -2617,22 +2635,23 @@
if((cur_tab == g->tab) || (g->shared->tabs == 0))
{
- RefreshSetGadgetAttrs((APTR)g->shared->objects[OID_VSCROLL],g->shared->win,NULL,
- SCROLLER_Top,sy,
+ RefreshSetGadgetAttrs((APTR)g->shared->objects[OID_VSCROLL],
+ g->shared->win, NULL,
+ SCROLLER_Top, sy * g->shared->bw->scale,
TAG_DONE);
if(g->shared->gadgets[GID_HSCROLL])
{
RefreshSetGadgetAttrs((APTR)g->shared->gadgets[GID_HSCROLL],
g->shared->win, NULL,
- PGA_Top, sx,
+ PGA_Top, sx * g->shared->bw->scale,
TAG_DONE);
}
else if(g->shared->objects[OID_HSCROLL])
{
RefreshSetGadgetAttrs((APTR)g->shared->objects[OID_HSCROLL],
g->shared->win, NULL,
- SCROLLER_Top, sx,
+ SCROLLER_Top, sx * g->shared->bw->scale,
TAG_DONE);
}
g->shared->redraw_required = true;
@@ -2640,7 +2659,6 @@
if(option_faster_scroll) g->shared->redraw_scroll = true;
else g->shared->redraw_scroll = false;
-
g->scrollx = sx;
g->scrolly = sy;
@@ -2695,21 +2713,16 @@
{
GetAttr(SPACE_AreaBox,g->shared->gadgets[GID_BROWSER],(ULONG *)&bbox);
-/*
- printf("upd ext %ld,%ld\n",g->bw->current_content->width, // * g->bw->scale,
- g->bw->current_content->height); // * g->bw->scale);
-*/
-
RefreshSetGadgetAttrs((APTR)g->shared->objects[OID_VSCROLL],g->shared->win,NULL,
- SCROLLER_Total,g->shared->bw->current_content->height,
- SCROLLER_Visible,bbox->Height,
+ SCROLLER_Total, (ULONG)(g->shared->bw->current_content->height * g->shared->bw->scale),
+ SCROLLER_Visible, bbox->Height,
TAG_DONE);
if(g->shared->gadgets[GID_HSCROLL])
{
RefreshSetGadgetAttrs((APTR)g->shared->gadgets[GID_HSCROLL],
g->shared->win, NULL,
- PGA_Total, g->shared->bw->current_content->width,
+ PGA_Total, (ULONG)(g->shared->bw->current_content->width * g->shared->bw->scale),
PGA_Visible, bbox->Width,
TAG_DONE);
}
@@ -2717,7 +2730,7 @@
{
RefreshSetGadgetAttrs((APTR)g->shared->objects[OID_HSCROLL],
g->shared->win, NULL,
- SCROLLER_Total, g->shared->bw->current_content->width,
+ SCROLLER_Total, (ULONG)(g->shared->bw->current_content->width * g->shared->bw->scale),
SCROLLER_Visible, bbox->Width,
TAG_DONE);
}
@@ -3029,7 +3042,7 @@
GetAttr(SPACE_AreaBox,g->shared->gadgets[GID_BROWSER],(ULONG *)&bbox);
ami_get_hscroll_pos(g->shared, (ULONG *)&xs);
- GetAttr(SCROLLER_Top,g->shared->objects[OID_VSCROLL],&ys);
+ ami_get_vscroll_pos(g->shared, (ULONG *)&ys);
SetAPen(g->shared->win->RPort,3);
@@ -3057,7 +3070,7 @@
GetAttr(SPACE_AreaBox,g->shared->gadgets[GID_BROWSER],(ULONG *)&bbox);
ami_get_hscroll_pos(g->shared, (ULONG *)&xs);
- GetAttr(SCROLLER_Top,g->shared->objects[OID_VSCROLL],(ULONG *)&ys);
+ ami_get_vscroll_pos(g->shared, (ULONG *)&ys);
BltBitMapRastPort(browserglob.bm,g->c_x-xs,g->c_y-ys,g->shared->win->RPort,bbox->Left+g->c_x-xs,bbox->Top+g->c_y-ys,2+1,g->c_h+1,0x0C0);
@@ -3141,7 +3154,9 @@
void gui_window_set_scale(struct gui_window *g, float scale)
{
- printf("set scale\n");
+ browserglob.scale = scale;
+ g->shared->new_content = true;
+ g->shared->redraw_required = true;
}
void gui_create_form_select_menu(struct browser_window *bw,
Modified: trunk/netsurf/amiga/menu.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/menu.c?rev=9513&r1=...
==============================================================================
--- trunk/netsurf/amiga/menu.c (original)
+++ trunk/netsurf/amiga/menu.c Sun Aug 30 16:43:14 2009
@@ -100,17 +100,20 @@
menulab[24] = ami_utf8_easy((char *)messages_get("Browser"));
menulab[25] = ami_utf8_easy((char *)messages_get("FindTextNS"));
menulab[26] = NM_BARLABEL;
- menulab[27] = ami_utf8_easy((char *)messages_get("normal"));
- menulab[28] = ami_utf8_easy((char *)messages_get("HistLocalNS"));
- menulab[29] = ami_utf8_easy((char *)messages_get("HistGlobalNS"));
- menulab[30] = NM_BARLABEL;
- menulab[31] = ami_utf8_easy((char *)messages_get("ShowCookies"));
- menulab[32] = NM_BARLABEL;
- menulab[33] = ami_utf8_easy((char *)messages_get("Redraw"));
- menulab[34] = ami_utf8_easy((char *)messages_get("Hotlist"));
- menulab[35] = ami_utf8_easy((char *)messages_get("HotlistAdd"));
- menulab[36] = ami_utf8_easy((char *)messages_get("HotlistShowNS"));
- menulab[37] = NM_BARLABEL;
+ menulab[27] = ami_utf8_easy((char *)messages_get("HistLocalNS"));
+ menulab[28] = ami_utf8_easy((char *)messages_get("HistGlobalNS"));
+ menulab[29] = NM_BARLABEL;
+ menulab[30] = ami_utf8_easy((char *)messages_get("ShowCookies"));
+ menulab[31] = NM_BARLABEL;
+ menulab[32] = ami_utf8_easy((char *)messages_get("Scale"));
+ menulab[33] = ami_utf8_easy((char *)messages_get("ScaleDec"));
+ menulab[34] = ami_utf8_easy((char *)messages_get("ScaleNorm"));
+ menulab[35] = ami_utf8_easy((char *)messages_get("ScaleInc"));
+ menulab[36] = ami_utf8_easy((char *)messages_get("Redraw"));
+ menulab[37] = ami_utf8_easy((char *)messages_get("Hotlist"));
+ menulab[38] = ami_utf8_easy((char *)messages_get("HotlistAdd"));
+ menulab[39] = ami_utf8_easy((char *)messages_get("HotlistShowNS"));
+ menulab[40] = NM_BARLABEL;
menulab[AMI_MENU_HOTLIST_MAX] = ami_utf8_easy((char *)messages_get("Settings"));
menulab[AMI_MENU_HOTLIST_MAX+1] = ami_utf8_easy((char *)messages_get("SettingsEdit"));
@@ -154,12 +157,15 @@
{NM_TITLE,0,0,0,0,0,}, // browser
{ NM_ITEM,0,"F",0,0,0,}, // find in page
{ NM_ITEM,NM_BARLABEL,0,0,0,0,},
- {NM_IGNORE,0,0,0,0,0,}, // was test option for scaling
{ NM_ITEM,0,0,0,0,0,}, // local history
{ NM_ITEM,0,0,0,0,0,}, // global history
{ NM_ITEM,NM_BARLABEL,0,0,0,0,},
{ NM_ITEM,0,0,0,0,0,}, // cookies
{ NM_ITEM,NM_BARLABEL,0,0,0,0,},
+ { NM_ITEM,0,0,0,0,0,}, // scale
+ { NM_SUB,0,"-",0,0,0,}, // decrease
+ { NM_SUB,0,"=",0,0,0,}, // normal
+ { NM_SUB,0,"+",0,0,0,}, // increase
{ NM_ITEM,0,0,0,0,0,}, // redraw
{NM_TITLE,0,0,0,0,0,}, // hotlist
{ NM_ITEM,0,0,0,0,0,}, // add to hotlist
@@ -647,19 +653,6 @@
ami_search_open(gwin->bw->window);
break;
- case 1: // size
- switch(subnum)
- {
- case 0: // normal
- gwin->bw->scale = 1.0;
- break;
-
- case 1: // double
- gwin->bw->scale = 2.0;
- break;
- }
- break;
-
case 2: // local history
if(gwin->bw && gwin->bw->history)
ami_history_open(gwin->bw, gwin->bw->history);
@@ -673,7 +666,27 @@
ami_open_tree(cookies_tree,AMI_TREE_COOKIES);
break;
- case 7: // redraw
+ case 7: // size
+ switch(subnum)
+ {
+ case 0: // decrease */
+ if(gwin->bw->scale > 0.1)
+ browser_window_set_scale(gwin->bw,
+ gwin->bw->scale - 0.1, false);
+ break;
+
+ case 1: // normal */
+ browser_window_set_scale(gwin->bw, 1.0, false);
+ break;
+
+ case 2: // increase */
+ browser_window_set_scale(gwin->bw,
+ gwin->bw->scale + 0.1, false);
+ break;
+ }
+ break;
+
+ case 8: // redraw
gwin->redraw_required = true;
gwin->new_content = true;
break;
Modified: trunk/netsurf/amiga/menu.h
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/menu.h?rev=9513&r1=...
==============================================================================
--- trunk/netsurf/amiga/menu.h (original)
+++ trunk/netsurf/amiga/menu.h Sun Aug 30 16:43:14 2009
@@ -28,10 +28,10 @@
/* Maximum number of menu items - first value is number of static items
* (ie. everything not intially defined as NM_IGNORE) */
-#define AMI_MENU_MAX 46 + AMI_HOTLIST_ITEMS
+#define AMI_MENU_MAX 49 + AMI_HOTLIST_ITEMS
/* Where the hotlist entries start */
-#define AMI_MENU_HOTLIST 38
+#define AMI_MENU_HOTLIST 41
/* Where the hotlist entries end */
#define AMI_MENU_HOTLIST_MAX AMI_MENU_HOTLIST+AMI_HOTLIST_ITEMS
14 years, 3 months
r9512 MarkieB - in /branches/MarkieB/windows/windows: download.c download.h
by netsurf@semichrome.net
Author: MarkieB
Date: Sun Aug 30 12:31:44 2009
New Revision: 9512
URL: http://source.netsurf-browser.org?rev=9512&view=rev
Log:
add the download files too :o)
Added:
branches/MarkieB/windows/windows/download.c
branches/MarkieB/windows/windows/download.h
Added: branches/MarkieB/windows/windows/download.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/downlo...
==============================================================================
--- branches/MarkieB/windows/windows/download.c (added)
+++ branches/MarkieB/windows/windows/download.c Sun Aug 30 12:31:44 2009
@@ -1,0 +1,121 @@
+/*
+ * Copyright 2009 Mark Benjamin <netsurf-browser.org.MarkBenjamin(a)dfgh.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>
+#define _WIN32_IE 0x0500
+#include <windows.h>
+#include <shlobj.h>
+
+#include "content/fetch.h"
+#include "desktop/gui.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/url.h"
+#include "utils/utils.h"
+#include "utils/win32.h"
+#include "windows/download.h"
+#include "windows/windows.h"
+
+static bool downloading = false;
+
+static bool nsws_download_window_up(struct gui_download_window *w);
+BOOL CALLBACK nsws_download_event_callback(HWND hwnd, UINT msg, WPARAM wparam,
+ LPARAM lparam);
+
+struct gui_download_window *gui_download_window_create(const char *url,
+ const char *mime_type, struct fetch *fetch,
+ unsigned int total_size, struct gui_window *gui)
+{
+ if (downloading) {
+ /* initial implementation */
+ warn_user("1 download at a time please", 0);
+ return NULL;
+ }
+ downloading = true;
+ struct gui_download_window *w =
+ malloc(sizeof(struct gui_download_window));
+ char *domain, *filename, *destination;
+ bool unknown_size = (total_size == 0);
+ const char *size = (unknown_size) ?
+ messages_get("UnknownSize") :
+ human_friendly_bytesize(total_size);
+
+ if (url_nice(url, &filename, false) != URL_FUNC_OK)
+ filename = strdup(messages_get("UnknownFile"));
+ if (url_host(url, &domain) != URL_FUNC_OK)
+ domain = strdup(messages_get("UnknownHost"));
+
+ destination = malloc(PATH_MAX);
+ SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, SHGFP_TYPE_CURRENT,
+ destination);
+ LOG(("download %s [%s] from %s to %s", filename, size, domain,
+ destination));
+ w->fetch = fetch;
+ w->title = filename;
+ w->domain = domain;
+ w->time_left = strdup("");
+ w->size = total_size;
+ w->downloaded = 0;
+ w->speed = 0;
+ gettimeofday(&(w->start_time), NULL);
+ w->time_remaining = -1;
+ w->status = DOWNLOAD_NONE;
+ w->filename = strdup(destination);
+ w->progress = 0;
+ w->error = 0;
+
+ free(destination);
+ nsws_download_window_up(w);
+ return w;
+}
+
+bool nsws_download_window_up(struct gui_download_window *w)
+{
+ int ret = DialogBox(hinstance, MAKEINTRESOURCE(NSWS_ID_DOWNLOAD_DIALOG),
+ NULL, nsws_download_event_callback);
+ if (ret == -1) {
+ warn_user(messages_get("NoMemory"), 0);
+ return false;
+ }
+ return true;
+}
+
+BOOL CALLBACK nsws_download_event_callback(HWND hwnd, UINT msg, WPARAM wparam,
+ LPARAM lparam)
+{
+ return FALSE;
+}
+
+void gui_download_window_data(struct gui_download_window *w, const char *data,
+ unsigned int size)
+{
+
+}
+
+void gui_download_window_error(struct gui_download_window *w,
+ const char *error_msg)
+{
+
+}
+
+void gui_download_window_done(struct gui_download_window *w)
+{
+ downloading = false;
+ DestroyWindow(w->hwnd);
+}
+
Added: branches/MarkieB/windows/windows/download.h
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/downlo...
==============================================================================
--- branches/MarkieB/windows/windows/download.h (added)
+++ branches/MarkieB/windows/windows/download.h Sun Aug 30 12:31:44 2009
@@ -1,0 +1,46 @@
+/*
+ * Copyright 2009 Mark Benjamin <netsurf-browser.org.MarkBenjamin(a)dfgh.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 _NETSURF_WINDOWS_DOWNLOAD_H_
+#define _NETSURF_WINDOWS_DOWNLOAD_H_
+
+#include <time.h>
+#include <windows.h>
+#include "desktop/gui.h"
+
+struct gui_download_window {
+ HWND hwnd;
+ char *title;
+ char *filename;
+ char *domain;
+ char *time_left;
+ int size;
+ int downloaded;
+ int progress;
+ int time_remaining;
+ struct timeval start_time;
+ int speed;
+ int error;
+ struct fetch *fetch;
+ struct gui_window *window;
+ download_status status;
+};
+
+void nsws_download_window_init(struct gui_window *);
+
+#endif
14 years, 3 months
r9511 MarkieB - in /branches/MarkieB/windows: !NetSurf/Resources/de/ !NetSurf/Resources/en/ !NetSurf/Resources/fr/ !NetSurf/Resources/it/ !NetSurf/Resources/nl/ ./ content/ gtk/ installer/ windows/ windows/res/
by netsurf@semichrome.net
Author: MarkieB
Date: Sun Aug 30 12:29:21 2009
New Revision: 9511
URL: http://source.netsurf-browser.org?rev=9511&view=rev
Log:
preliminary download window; include migration of some enums from gtk download to core; simplify
message mnemonics for universal download messages
Modified:
branches/MarkieB/windows/!NetSurf/Resources/de/Messages
branches/MarkieB/windows/!NetSurf/Resources/en/Messages
branches/MarkieB/windows/!NetSurf/Resources/fr/Messages
branches/MarkieB/windows/!NetSurf/Resources/it/Messages
branches/MarkieB/windows/!NetSurf/Resources/nl/Messages
branches/MarkieB/windows/Makefile.sources
branches/MarkieB/windows/content/fetch.h
branches/MarkieB/windows/gtk/gtk_download.c
branches/MarkieB/windows/gtk/gtk_download.h
branches/MarkieB/windows/gtk/gtk_history.c
branches/MarkieB/windows/installer/NetSurfInstaller.nsi
branches/MarkieB/windows/windows/gui.c
branches/MarkieB/windows/windows/res/resource.o
branches/MarkieB/windows/windows/res/resource.rc
branches/MarkieB/windows/windows/windows.h
Modified: branches/MarkieB/windows/!NetSurf/Resources/de/Messages
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/%21NetSurf/Res...
==============================================================================
--- branches/MarkieB/windows/!NetSurf/Resources/de/Messages (original)
+++ branches/MarkieB/windows/!NetSurf/Resources/de/Messages Sun Aug 30 12:29:21 2009
@@ -381,6 +381,9 @@
Downloaded:%s komplett ⢠etwa %s/s ⢠gesamt %s
Unwritten:Schreiben der Datei ist fehlgeschlagen.
Abort:Abort
+UnknownHost:an unknown host
+UnknownFile:
+UnknownSize:unknown
# Amiga download window tokens
#
@@ -428,9 +431,7 @@
gtkFileError:File error: %s
gtkInfo:%s from %s is %s in size
gtkSave:Save file as...
-gtkUnknownHost:an unknown host
-gtkUnknownFile:
-gtkUnknownSize:unknown
+
# Printing user interface tokens
# ==============================
Modified: branches/MarkieB/windows/!NetSurf/Resources/en/Messages
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/%21NetSurf/Res...
==============================================================================
--- branches/MarkieB/windows/!NetSurf/Resources/en/Messages (original)
+++ branches/MarkieB/windows/!NetSurf/Resources/en/Messages Sun Aug 30 12:29:21 2009
@@ -381,6 +381,9 @@
Downloaded:%s complete ⢠average %s/s ⢠%s total
Unwritten:Writing data to file failed.
Abort:Abort
+UnknownFile:
+UnknownSize:unknown
+UnknownHost:an unknown host
# Amiga download window tokens
#
@@ -432,9 +435,8 @@
gtkSourceSave:Save source
gtkSaveConfirm:File saved
gtkSaveCancelled:File not saved
-gtkUnknownHost:an unknown host
-gtkUnknownFile:
-gtkUnknownSize:unknown
+
+
# Printing user interface tokens
# ==============================
Modified: branches/MarkieB/windows/!NetSurf/Resources/fr/Messages
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/%21NetSurf/Res...
==============================================================================
--- branches/MarkieB/windows/!NetSurf/Resources/fr/Messages (original)
+++ branches/MarkieB/windows/!NetSurf/Resources/fr/Messages Sun Aug 30 12:29:21 2009
@@ -381,6 +381,9 @@
Downloaded:%s effectués ⢠moyenne %s/s ⢠%s total
Unwritten:L'écriture de données dans le fichier a échoué.
Abort:Abort
+UnknownHost:an unknown host
+UnknownFile:
+UnknownSize:inconnu
# Amiga download window tokens
#
@@ -428,9 +431,7 @@
gtkFileError:File error: %s
gtkInfo:%s from %s is %s in size
gtkSave:Save file as...
-gtkUnknownHost:an unknown host
-gtkUnknownFile:
-gtkUnknownSize:unknown
+
# Printing user interface tokens
# ==============================
Modified: branches/MarkieB/windows/!NetSurf/Resources/it/Messages
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/%21NetSurf/Res...
==============================================================================
--- branches/MarkieB/windows/!NetSurf/Resources/it/Messages (original)
+++ branches/MarkieB/windows/!NetSurf/Resources/it/Messages Sun Aug 30 12:29:21 2009
@@ -383,6 +383,9 @@
Downloaded:%s completato ? media %s/s ? %s totale
Unwritten:Scrittura dei dati sul file fallita.
Abort:Annulla
+UnknownHost:un Host sconosciuto
+UnknownFile:
+UnknownSize:sconosciuto
# Amiga download window tokens
#
@@ -435,9 +438,7 @@
gtkSourceSave:Salva sorgente
gtkSaveConfirm:File salvato
gtkSaveCancelled:File non salvato
-gtkUnknownHost:un Host sconosciuto
-gtkUnknownFile:
-gtkUnknownSize:sconosciuto
+
# Printing user interface tokens
# ==============================
Modified: branches/MarkieB/windows/!NetSurf/Resources/nl/Messages
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/%21NetSurf/Res...
==============================================================================
--- branches/MarkieB/windows/!NetSurf/Resources/nl/Messages (original)
+++ branches/MarkieB/windows/!NetSurf/Resources/nl/Messages Sun Aug 30 12:29:21 2009
@@ -381,6 +381,9 @@
Downloaded:%s compleet ⢠gemiddeld %s/s ⢠%s totaal
Unwritten:Data naar bestand schrijven ging fout.
Abort:Abort
+UnknownHost:an unknown host
+UnknownFile:
+UnknownSize:unknown
# Amiga download window tokens
#
@@ -428,9 +431,6 @@
gtkFileError:File error: %s
gtkInfo:%s from %s is %s in size
gtkSave:Save file as...
-gtkUnknownHost:an unknown host
-gtkUnknownFile:
-gtkUnknownSize:unknown
# Printing user interface tokens
# ==============================
Modified: branches/MarkieB/windows/Makefile.sources
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/Makefile.sourc...
==============================================================================
--- branches/MarkieB/windows/Makefile.sources (original)
+++ branches/MarkieB/windows/Makefile.sources Sun Aug 30 12:29:21 2009
@@ -65,9 +65,9 @@
S_GTK := $(addprefix gtk/,$(S_GTK))
# S_WINDOWS are sources purely for the windows build
-S_WINDOWS := about.c bitmap.c filetype.c findfile.c font.c gui.c \
- history.c hotlist.c localhistory.c login.c misc.c plot.c prefs.c \
- schedule.c thumbnail.c tree.c
+S_WINDOWS := about.c bitmap.c download.c filetype.c findfile.c font.c \
+ gui.c history.c hotlist.c localhistory.c login.c misc.c plot.c \
+ prefs.c schedule.c thumbnail.c tree.c
S_WINDOWS := $(addprefix windows/,$(S_WINDOWS)) utils/win32.c
Modified: branches/MarkieB/windows/content/fetch.h
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/content/fetch....
==============================================================================
--- branches/MarkieB/windows/content/fetch.h (original)
+++ branches/MarkieB/windows/content/fetch.h Sun Aug 30 12:29:21 2009
@@ -42,6 +42,21 @@
FETCH_AUTH,
FETCH_CERT_ERR,
} fetch_msg;
+
+typedef enum {
+ DOWNLOAD_NONE,
+ DOWNLOAD_WORKING,
+ DOWNLOAD_ERROR,
+ DOWNLOAD_COMPLETE,
+ DOWNLOAD_CANCELED
+} download_status;
+
+typedef enum {
+ DOWNLOAD_PAUSE = 1 << 0,
+ DOWNLOAD_RESUME = 1 << 1,
+ DOWNLOAD_CANCEL = 1 << 2,
+ DOWNLOAD_CLEAR = 1 << 3
+} download_actions;
struct content;
struct fetch;
Modified: branches/MarkieB/windows/gtk/gtk_download.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/gtk/gtk_downlo...
==============================================================================
--- branches/MarkieB/windows/gtk/gtk_download.c (original)
+++ branches/MarkieB/windows/gtk/gtk_download.c Sun Aug 30 12:29:21 2009
@@ -69,12 +69,12 @@
static void nsgtk_download_sensitivity_evaluate(GtkTreeSelection *selection);
static void nsgtk_download_sensitivity_update_buttons(
- nsgtk_download_actions sensitivity);
+ download_actions sensitivity);
static void nsgtk_download_change_sensitivity(
- struct gui_download_window *dl, nsgtk_download_actions sens);
+ struct gui_download_window *dl, download_actions sens);
static void nsgtk_download_change_status (
- struct gui_download_window *dl, nsgtk_download_status status);
+ struct gui_download_window *dl, download_status status);
static gchar* nsgtk_download_dialog_show (gchar *filename, gchar *domain,
const gchar *size);
@@ -203,16 +203,16 @@
gchar *destination;
gboolean unknown_size = total_size == 0;
const gchar *size = (total_size == 0 ?
- messages_get("gtkUnknownSize") :
+ messages_get("UnknownSize") :
human_friendly_bytesize(total_size));
nsgtk_download_parent = nsgtk_scaffolding_get_window(gui);
struct gui_download_window *download = malloc(sizeof *download);
if (url_nice(url, &filename, false) != URL_FUNC_OK)
- strcpy(filename, messages_get("gtkUnknownFile"));
+ strcpy(filename, messages_get("UnknownFile"));
if (url_host(url, &domain) != URL_FUNC_OK)
- strcpy(domain, messages_get("gtkUnknownHost"));
+ strcpy(domain, messages_get("UnknownHost"));
destination = nsgtk_download_dialog_show(filename, domain, size);
if (destination == NULL)
@@ -234,7 +234,7 @@
download->speed = 0;
download->start_time = g_timer_elapsed(nsgtk_downloads_timer, NULL);
download->time_remaining = -1;
- download->status = NSGTK_DOWNLOAD_NONE;
+ download->status = DOWNLOAD_NONE;
download->filename = destination;
download->progress = 0;
download->error = NULL;
@@ -250,14 +250,13 @@
g_io_channel_set_encoding(download->write, NULL,
&download->error);
- nsgtk_download_change_sensitivity(download, NSGTK_DOWNLOAD_CANCEL);
+ nsgtk_download_change_sensitivity(download, DOWNLOAD_CANCEL);
nsgtk_download_store_create_item(download);
nsgtk_download_show(nsgtk_download_parent);
if (unknown_size)
- nsgtk_download_change_status(download,
- NSGTK_DOWNLOAD_WORKING);
+ nsgtk_download_change_status(download, DOWNLOAD_WORKING);
if (nsgtk_downloads_num_active == 0)
g_timeout_add(UPDATE_RATE, (GSourceFunc)nsgtk_download_update,
@@ -276,8 +275,8 @@
dw->speed = 0;
dw->time_remaining = -1;
- nsgtk_download_change_sensitivity(dw, NSGTK_DOWNLOAD_CLEAR);
- nsgtk_download_change_status(dw, NSGTK_DOWNLOAD_ERROR);
+ nsgtk_download_change_sensitivity(dw, DOWNLOAD_CLEAR);
+ nsgtk_download_change_status(dw, DOWNLOAD_ERROR);
nsgtk_download_update(TRUE);
fetch_abort(dw->fetch);
@@ -304,8 +303,8 @@
dw->time_remaining = -1;
dw->progress = 100;
dw->size_total = dw->size_downloaded;
- nsgtk_download_change_sensitivity(dw, NSGTK_DOWNLOAD_CLEAR);
- nsgtk_download_change_status(dw, NSGTK_DOWNLOAD_COMPLETE);
+ nsgtk_download_change_sensitivity(dw, DOWNLOAD_CLEAR);
+ nsgtk_download_change_status(dw, DOWNLOAD_COMPLETE);
if (option_downloads_clear)
nsgtk_download_store_clear_item(dw);
@@ -428,13 +427,13 @@
update = force_update;
switch (dl->status) {
- case NSGTK_DOWNLOAD_WORKING:
+ case DOWNLOAD_WORKING:
pulse_mode = TRUE;
- case NSGTK_DOWNLOAD_NONE:
+ case DOWNLOAD_NONE:
dl->speed = dl->size_downloaded /
(elapsed - dl->start_time);
- if (dl->status == NSGTK_DOWNLOAD_NONE) {
+ if (dl->status == DOWNLOAD_NONE) {
dl->time_remaining = (dl->size_total -
dl->size_downloaded)/
dl->speed;
@@ -447,7 +446,7 @@
nsgtk_downloads_num_active++;
update = TRUE;
- case NSGTK_DOWNLOAD_COMPLETE:
+ case DOWNLOAD_COMPLETE:
downloaded += dl->size_downloaded;
total += dl->size_total;
dls++;
@@ -491,7 +490,7 @@
gchar *speed = g_strconcat(human_friendly_bytesize(dl->speed), "/s",
NULL);
gchar *time = nsgtk_download_time_to_string(dl->time_remaining);
- gboolean pulse = dl->status == NSGTK_DOWNLOAD_WORKING;
+ gboolean pulse = dl->status == DOWNLOAD_WORKING;
/* Updates iter (which is needed to set and get data) with the dl row */
gtk_tree_model_get_iter(GTK_TREE_MODEL(nsgtk_download_store),
@@ -522,7 +521,7 @@
void nsgtk_download_store_clear_item (struct gui_download_window *dl)
{
- if (dl->sensitivity & NSGTK_DOWNLOAD_CLEAR) {
+ if (dl->sensitivity & DOWNLOAD_CLEAR) {
nsgtk_downloads_list = g_list_remove(nsgtk_downloads_list, dl);
gtk_tree_model_get_iter(GTK_TREE_MODEL(nsgtk_download_store),
@@ -542,13 +541,13 @@
void nsgtk_download_store_cancel_item (struct gui_download_window *dl)
{
- if (dl->sensitivity & NSGTK_DOWNLOAD_CANCEL) {
+ if (dl->sensitivity & DOWNLOAD_CANCEL) {
dl->speed = 0;
dl->size_downloaded = 0;
dl->progress = 0;
dl->time_remaining = -1;
- nsgtk_download_change_sensitivity(dl, NSGTK_DOWNLOAD_CLEAR);
- nsgtk_download_change_status(dl, NSGTK_DOWNLOAD_CANCELED);
+ nsgtk_download_change_sensitivity(dl, DOWNLOAD_CLEAR);
+ nsgtk_download_change_status(dl, DOWNLOAD_CANCELED);
if (dl->fetch)
fetch_abort(dl->fetch);
@@ -565,7 +564,7 @@
GList *rows;
gboolean selected = gtk_tree_selection_count_selected_rows(selection);
GtkTreeModel *model = GTK_TREE_MODEL(nsgtk_download_store);
- nsgtk_download_actions sensitivity = 0;
+ download_actions sensitivity = 0;
struct gui_download_window *dl;
if (selected) {
@@ -582,7 +581,7 @@
rows = nsgtk_downloads_list;
while (rows != NULL) {
dl = rows->data;
- sensitivity |= (dl->sensitivity & NSGTK_DOWNLOAD_CLEAR);
+ sensitivity |= (dl->sensitivity & DOWNLOAD_CLEAR);
rows = rows->next;
}
}
@@ -591,34 +590,33 @@
nsgtk_download_sensitivity_update_buttons(sensitivity);
}
-void nsgtk_download_sensitivity_update_buttons(
- nsgtk_download_actions sensitivity)
+void nsgtk_download_sensitivity_update_buttons(download_actions sensitivity)
{
/* Glade seems to pack the buttons in an arbitrary order */
enum { PAUSE_BUTTON, CLEAR_BUTTON, CANCEL_BUTTON, RESUME_BUTTON };
gtk_widget_set_sensitive(g_list_nth_data(nsgtk_download_buttons,
- PAUSE_BUTTON), sensitivity & NSGTK_DOWNLOAD_PAUSE);
+ PAUSE_BUTTON), sensitivity & DOWNLOAD_PAUSE);
gtk_widget_set_sensitive(g_list_nth_data(nsgtk_download_buttons,
- CLEAR_BUTTON), sensitivity & NSGTK_DOWNLOAD_CLEAR);
+ CLEAR_BUTTON), sensitivity & DOWNLOAD_CLEAR);
gtk_widget_set_sensitive(g_list_nth_data(nsgtk_download_buttons,
- CANCEL_BUTTON), sensitivity & NSGTK_DOWNLOAD_CANCEL);
+ CANCEL_BUTTON), sensitivity & DOWNLOAD_CANCEL);
gtk_widget_set_sensitive(g_list_nth_data(nsgtk_download_buttons,
- RESUME_BUTTON), sensitivity & NSGTK_DOWNLOAD_RESUME);
+ RESUME_BUTTON), sensitivity & DOWNLOAD_RESUME);
}
void nsgtk_download_change_sensitivity(struct gui_download_window *dl,
- nsgtk_download_actions sensitivity)
+ download_actions sensitivity)
{
dl->sensitivity = sensitivity;
nsgtk_download_sensitivity_evaluate(nsgtk_download_selection);
}
void nsgtk_download_change_status (
- struct gui_download_window *dl, nsgtk_download_status status)
+ struct gui_download_window *dl, download_status status)
{
dl->status = status;
- if (status != NSGTK_DOWNLOAD_NONE) {
+ if (status != DOWNLOAD_NONE) {
gtk_tree_model_get_iter(GTK_TREE_MODEL(nsgtk_download_store),
&nsgtk_download_iter,
gtk_tree_row_reference_get_path(dl->row));
@@ -732,12 +730,12 @@
{
gchar *size_info = g_strdup_printf(messages_get("gtkSizeInfo"),
human_friendly_bytesize(dl->size_downloaded),
- dl->size_total == 0 ? messages_get("gtkUnknownSize") :
+ dl->size_total == 0 ? messages_get("UnknownSize") :
human_friendly_bytesize(dl->size_total));
gchar *r;
- if (dl->status != NSGTK_DOWNLOAD_ERROR)
+ if (dl->status != DOWNLOAD_ERROR)
r = g_strdup_printf("%s\n%s", dl->name->str, size_info);
else
r = g_strdup_printf("%s\n%s", dl->name->str,
Modified: branches/MarkieB/windows/gtk/gtk_download.h
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/gtk/gtk_downlo...
==============================================================================
--- branches/MarkieB/windows/gtk/gtk_download.h (original)
+++ branches/MarkieB/windows/gtk/gtk_download.h Sun Aug 30 12:29:21 2009
@@ -20,6 +20,7 @@
#define GTK_DOWNLOAD_H
#include <gtk/gtk.h>
+#include "content/fetch.h"
enum {
NSGTK_DOWNLOAD_PROGRESS,
@@ -33,25 +34,10 @@
NSGTK_DOWNLOAD_N_COLUMNS
};
-typedef enum {
- NSGTK_DOWNLOAD_NONE,
- NSGTK_DOWNLOAD_WORKING,
- NSGTK_DOWNLOAD_ERROR,
- NSGTK_DOWNLOAD_COMPLETE,
- NSGTK_DOWNLOAD_CANCELED
-} nsgtk_download_status;
-
-typedef enum {
- NSGTK_DOWNLOAD_PAUSE = 1 << 0,
- NSGTK_DOWNLOAD_RESUME = 1 << 1,
- NSGTK_DOWNLOAD_CANCEL = 1 << 2,
- NSGTK_DOWNLOAD_CLEAR = 1 << 3
-} nsgtk_download_actions;
-
struct gui_download_window {
struct fetch *fetch;
- nsgtk_download_actions sensitivity;
- nsgtk_download_status status;
+ download_actions sensitivity;
+ download_status status;
GString *name;
GString *time_left;
Modified: branches/MarkieB/windows/gtk/gtk_history.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/gtk/gtk_histor...
==============================================================================
--- branches/MarkieB/windows/gtk/gtk_history.c (original)
+++ branches/MarkieB/windows/gtk/gtk_history.c Sun Aug 30 12:29:21 2009
@@ -277,7 +277,7 @@
GtkTreeIter iter;
gchar *domain, *path;
if (url_host(url, &domain) != URL_FUNC_OK)
- strcpy(domain, messages_get("gtkUnknownHost"));
+ strcpy(domain, messages_get("UnknownHost"));
if (data->visits > 0)
{
@@ -316,7 +316,7 @@
gtk_list_store_append(history->domain_list, &iter);
gtk_list_store_set(history->domain_list, &iter,
DOM_DOMAIN, domain,
- DOM_LASTVISIT, messages_get("gtkUnknownHost"),
+ DOM_LASTVISIT, messages_get("UnknownHost"),
DOM_TOTALVISITS, 0,
-1);
Modified: branches/MarkieB/windows/installer/NetSurfInstaller.nsi
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/installer/NetS...
==============================================================================
--- branches/MarkieB/windows/installer/NetSurfInstaller.nsi (original)
+++ branches/MarkieB/windows/installer/NetSurfInstaller.nsi Sun Aug 30 12:29:21 2009
@@ -43,7 +43,6 @@
File ../windows/res/throbber.avi
IfFileExists $SMPROGRAMS\NetSurf\NetSurf.lnk +2
CreateDirectory "$SMPROGRAMS\NetSurf"
- SetOutPath "$INSTDIR"
CreateShortCut "$SMPROGRAMS\NetSurf\NetSurf.lnk" "$INSTDIR\NetSurf.exe" "" "$INSTDIR\res\NetSurf32.ico"
IfFileExists "$INSTDIR\src\*.*" +2
CreateDirectory "$INSTDIR\src"
Modified: branches/MarkieB/windows/windows/gui.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/gui.c?...
==============================================================================
--- branches/MarkieB/windows/windows/gui.c (original)
+++ branches/MarkieB/windows/windows/gui.c Sun Aug 30 12:29:21 2009
@@ -2065,27 +2065,6 @@
LOG(("%.2f\n", scale));
}
-struct gui_download_window *gui_download_window_create(const char *url,
- const char *mime_type, struct fetch *fetch,
- unsigned int total_size, struct gui_window *gui)
-{
- return NULL;
-}
-
-void gui_download_window_data(struct gui_download_window *dw, const char *data,
- unsigned int size)
-{
-}
-
-void gui_download_window_error(struct gui_download_window *dw,
- const char *error_msg)
-{
-}
-
-void gui_download_window_done(struct gui_download_window *dw)
-{
-}
-
void gui_drag_save_object(gui_save_type type, struct content *c,
struct gui_window *w)
{
Modified: branches/MarkieB/windows/windows/res/resource.o
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/res/re...
==============================================================================
Binary files - no diff available.
Modified: branches/MarkieB/windows/windows/res/resource.rc
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/res/re...
==============================================================================
--- branches/MarkieB/windows/windows/res/resource.rc (original)
+++ branches/MarkieB/windows/windows/res/resource.rc Sun Aug 30 12:29:21 2009
@@ -100,3 +100,18 @@
UPDOWN_CLASS,UDS_NOTHOUSANDS,170,189,10,15
END
+
+NSWS_ID_DOWNLOAD_DIALOG DIALOG DISCARDABLE 0, 0, 200, 100
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "download"
+FONT 8, "MS Sans Serif"
+BEGIN
+ PUSHBUTTON "&OK",IDOK,150,75,30,20
+ PUSHBUTTON "&Cancel",IDCANCEL,110,75,35,20
+
+ CTEXT
+ "downloading [file] [size] from [domain] to [destination]",
+ NSWS_ID_DOWNLOAD_LABEL,6,6,189,20
+ CONTROL "progress",NSWS_ID_DOWNLOAD_PROGRESS,PROGRESS_CLASS,
+ 0,6,35,189,30
+END
Modified: branches/MarkieB/windows/windows/windows.h
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/window...
==============================================================================
--- branches/MarkieB/windows/windows/windows.h (original)
+++ branches/MarkieB/windows/windows/windows.h Sun Aug 30 12:29:21 2009
@@ -54,6 +54,11 @@
#define NSWS_ID_PREFS_NOANIMATION 11140
#define NSWS_ID_PREFS_ANIMATIONDELAY 11141
#define NSWS_ID_PREFS_ANIMATIONDELAY_SPIN 11142
+#define NSWS_ID_DOWNLOAD_DIALOG 11143
+#define NSWS_ID_DOWNLOAD_LABEL 11144
+#define NSWS_ID_DOWNLOAD_PROGRESS 11145
+#define NSWS_ID_DOWNLOAD_PAUSE 11146
+#define NSWS_ID_DOWNLOAD_CANCEL 11147
#ifndef timeradd
#define timeradd(a, aa, result)\
14 years, 3 months