40#define NSWS_PREFS_WINDOW_WIDTH 600
42#define NSWS_PREFS_WINDOW_HEIGHT 400
54 CHOOSEFONT *cf = malloc(
sizeof(CHOOSEFONT));
59 LOGFONT *lf = malloc(
sizeof(LOGFONT));
67 snprintf(lf->lfFaceName, LF_FACESIZE,
"%s",
71 snprintf(lf->lfFaceName, LF_FACESIZE,
"%s",
75 snprintf(lf->lfFaceName, LF_FACESIZE,
"%s",
79 snprintf(lf->lfFaceName, LF_FACESIZE,
"%s",
84 snprintf(lf->lfFaceName, LF_FACESIZE,
"%s",
89 cf->lStructSize =
sizeof(CHOOSEFONT);
92 cf->Flags = CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT | CF_LIMITSIZE;
110 char *temp, number[6];
114 len = SendMessage(sub, WM_GETTEXTLENGTH, 0, 0);
115 temp = malloc(len + 1);
121 SendMessage(sub, WM_GETTEXT, (WPARAM)(len + 1), (LPARAM) temp);
123 value = strtod(temp, NULL) - change;
126 value =
max(value, minval);
127 value =
min(value, maxval);
129 if ((change == 1.0) || (change == -1.0)) {
130 snprintf(number, 6,
"%.0f", value);
132 snprintf(number, 6,
"%.1f", value);
135 SendMessage(sub, WM_SETTEXT, 0, (LPARAM)number);
154 char *temp, number[6];
162 SendMessage(sub, CB_ADDSTRING, 0, (LPARAM)
"Sans serif");
163 SendMessage(sub, CB_ADDSTRING, 0, (LPARAM)
"Serif");
164 SendMessage(sub, CB_ADDSTRING, 0, (LPARAM)
"Monospace");
165 SendMessage(sub, CB_ADDSTRING, 0, (LPARAM)
"Cursive");
166 SendMessage(sub, CB_ADDSTRING, 0, (LPARAM)
"Fantasy");
167 SendMessage(sub, CB_SETCURSEL,
173 SendMessage(sub, WM_SETTEXT, 0,
179 SendMessage(sub, WM_SETTEXT, 0,
185 SendMessage(sub, WM_SETTEXT, 0,
191 SendMessage(sub, WM_SETTEXT, 0,
197 SendMessage(sub, WM_SETTEXT, 0,
202 snprintf(number, 6,
"%.1f",
nsoption_int(font_min_size) / 10.0);
203 SendMessage(sub, WM_SETTEXT, 0, (LPARAM)number);
207 snprintf(number, 6,
"%.1f",
nsoption_int(font_size) / 10.0);
208 SendMessage(sub, WM_SETTEXT, 0, (LPARAM)number);
213 SendMessage(sub, WM_SETTEXT, 0, (LPARAM)number);
217 snprintf(number, 6,
"%d",
219 SendMessage(sub, WM_SETTEXT, 0, (LPARAM)number);
223 snprintf(number, 6,
"%d",
225 SendMessage(sub, WM_SETTEXT, 0, (LPARAM)number);
231 SendMessage(sub, BM_SETCHECK, (WPARAM)((
nsoption_bool(animate_images))
232 ? BST_UNCHECKED : BST_CHECKED), 0);
236 switch (((NMHDR FAR *)lParam)->code) {
239 len = SendMessage(sub, WM_GETTEXTLENGTH, 0, 0);
240 temp = malloc(len + 1);
242 SendMessage(sub, WM_GETTEXT, (WPARAM)
243 (len + 1), (LPARAM) temp);
245 (10 * strtod(temp, NULL));
250 len = SendMessage(sub, WM_GETTEXTLENGTH, 0, 0);
251 temp = malloc(len + 1);
253 SendMessage(sub, WM_GETTEXT, (WPARAM)
254 (len + 1), (LPARAM) temp);
256 (
int)(10 * strtod(temp, NULL)));
267 NMUPDOWN *ud = (NMUPDOWN *)lParam;
268 switch(((NMHDR *)lParam)->idFrom) {
284 NSLOG(netsurf, INFO,
"WM_COMMAND Identifier 0x%x",
287 switch(LOWORD(wparam)) {
291 SendMessage(sub, CB_GETCURSEL, 0, 0) - 1);
305 if (ChooseFont(cf) == TRUE) {
307 strdup(cf->lpLogFont->lfFaceName));
315 SendMessage(sub, WM_SETTEXT, 0,
327 if (ChooseFont(cf) == TRUE) {
329 strdup(cf->lpLogFont->lfFaceName));
337 SendMessage(sub, WM_SETTEXT, 0,
349 if (ChooseFont(cf) == TRUE) {
351 strdup(cf->lpLogFont->lfFaceName));
360 SendMessage(sub, WM_SETTEXT, 0,
372 if (ChooseFont(cf) == TRUE) {
374 strdup(cf->lpLogFont->lfFaceName));
381 SendMessage(sub, WM_SETTEXT, 0,
393 if (ChooseFont(cf) == TRUE) {
395 strdup(cf->lpLogFont->lfFaceName));
402 SendMessage(sub, WM_SETTEXT, 0,
411 SendMessage(sub, CB_GETCURSEL, 0, 0) + 1);
437 char *temp, number[6];
445 SendMessage(sub, CB_ADDSTRING, 0, (LPARAM)
"None");
446 SendMessage(sub, CB_ADDSTRING, 0, (LPARAM)
"Simple");
447 SendMessage(sub, CB_ADDSTRING, 0, (LPARAM)
"Basic Auth");
448 SendMessage(sub, CB_ADDSTRING, 0, (LPARAM)
"NTLM Auth");
450 SendMessage(sub, CB_SETCURSEL, (WPARAM)
453 SendMessage(sub, CB_SETCURSEL, 0, 0);
459 SendMessage(sub, WM_SETTEXT, 0,
464 snprintf(number, 6,
"%d",
nsoption_int(http_proxy_port));
465 SendMessage(sub, WM_SETTEXT, 0, (LPARAM)number);
471 SendMessage(sub, WM_SETTEXT, 0,
477 SendMessage(sub, WM_SETTEXT, 0,
482 SendMessage(sub, WM_SETTEXT, 0, (LPARAM)number);
485 snprintf(number, 6,
"%d",
nsoption_int(max_fetchers_per_host));
486 SendMessage(sub, WM_SETTEXT, 0, (LPARAM)number);
489 snprintf(number, 6,
"%d",
nsoption_int(max_cached_fetch_handles));
490 SendMessage(sub, WM_SETTEXT, 0, (LPARAM)number);
495 switch (((NMHDR FAR *)lParam)->code) {
498 len = SendMessage(sub, WM_GETTEXTLENGTH, 0, 0);
499 temp = malloc(len + 1);
501 SendMessage(sub, WM_GETTEXT, (WPARAM)(len + 1),
508 len = SendMessage(sub, WM_GETTEXTLENGTH, 0, 0);
509 temp = malloc(len + 1);
511 SendMessage(sub, WM_GETTEXT, (WPARAM)(len + 1),
518 len = SendMessage(sub, WM_GETTEXTLENGTH, 0, 0);
519 temp = malloc(len + 1);
521 SendMessage(sub, WM_GETTEXT, (WPARAM)(len + 1),
528 len = SendMessage(sub, WM_GETTEXTLENGTH, 0, 0);
529 temp = malloc(len + 1);
531 SendMessage(sub, WM_GETTEXT, (WPARAM)(len + 1),
539 len = SendMessage(sub, WM_GETTEXTLENGTH, 0, 0);
540 temp = malloc(len + 1);
542 SendMessage(sub, WM_GETTEXT, (WPARAM)(len + 1),
549 len = SendMessage(sub, WM_GETTEXTLENGTH, 0, 0);
550 temp = malloc(len + 1);
552 SendMessage(sub, WM_GETTEXT, (WPARAM)(len + 1),
559 len = SendMessage(sub, WM_GETTEXTLENGTH, 0, 0);
560 temp = malloc(len + 1);
562 SendMessage(sub, WM_GETTEXT, (WPARAM)(len + 1),
570 NMUPDOWN *ud = (NMUPDOWN *)lParam;
571 switch(((NMHDR *)lParam)->idFrom) {
615 SendMessage(sub, WM_SETTEXT, 0, (LPARAM)
nsoption_charp(homepage_url));
619 SendMessage(sub, BM_SETCHECK,
621 BST_CHECKED : BST_UNCHECKED), 0);
625 SendMessage(sub, BM_SETCHECK,
627 BST_CHECKED : BST_UNCHECKED), 0);
631 SendMessage(sub, BM_SETCHECK,
633 BST_CHECKED : BST_UNCHECKED), 0);
637 switch (((NMHDR FAR *)lParam)->code) {
644 text_length = SendMessage(sub,
645 WM_GETTEXTLENGTH, 0, 0);
646 text = malloc(text_length + 1);
648 SendMessage(sub, WM_GETTEXT,
649 (WPARAM)text_length + 1,
656 (IsDlgButtonChecked(hwnd,
IDC_PREFS_IMAGES) == BST_CHECKED) ?
true :
false);
676 char *choices = NULL;
692 PROPSHEETPAGE psp[3];
695 psp[0].dwSize =
sizeof(PROPSHEETPAGE);
697 psp[0].hInstance =
hinst;
701 psp[0].pfnCallback = NULL;
703 psp[1].dwSize =
sizeof(PROPSHEETPAGE);
705 psp[1].hInstance =
hinst;
709 psp[1].pfnCallback = NULL;
711 psp[2].dwSize =
sizeof(PROPSHEETPAGE);
713 psp[2].hInstance =
hinst;
717 psp[2].pfnCallback = NULL;
720 psh.dwSize =
sizeof(PROPSHEETHEADER);
721 psh.dwFlags = PSH_NOAPPLYNOW | PSH_USEICONID | PSH_PROPSHEETPAGE;
723 psh.hInstance =
hinst;
725 psh.pszCaption = (LPSTR)
"NetSurf Options";
726 psh.nPages =
sizeof(psp) /
sizeof(PROPSHEETPAGE);
728 psh.ppsp = (LPCPROPSHEETPAGE) &psp;
729 psh.pfnCallback = NULL;
731 ret = PropertySheet(&psh);
734 }
else if (ret > 0) {
nserror
Enumeration of error codes.
#define NSLOG(catname, level, logmsg, args...)
const char * messages_get(const char *key)
Fast lookup of a message by key from the standard Messages hash.
Localised message support (interface).
nserror nsws_prefs_save(void)
Save the users preferances.
static BOOL CALLBACK options_general_dialog_handler(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lParam)
Handle messages to the general preference dialog.
void nsws_prefs_dialog_init(HINSTANCE hinst, HWND parent)
open the preferences dialog and respond to user.
static BOOL CALLBACK options_connections_dialog_handler(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lParam)
Handle messages to the connections preference dialog.
static CHOOSEFONT * nsws_prefs_font_prepare(int fontfamily, HWND parent)
Prepare preferences dialog font tab.
static BOOL CALLBACK options_appearance_dialog_handler(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lParam)
Handle messages to the appearance preference dialog.
static void change_spinner(HWND sub, double change, double minval, double maxval)
Update value in spinner control when it is changed.
#define IDC_PREFS_PROXYPORT
#define IDC_PREFS_FETCHERS
#define IDC_PREFS_ADVERTS
#define IDC_PREFS_PROXYHOST
#define IDC_PREFS_PROXYTYPE
#define IDC_PREFS_FONT_SIZE
#define IDC_PREFS_FETCH_HOST
#define IDC_PREFS_PROXYPASS
#define IDC_PREFS_CURSIVE
#define IDD_OPTIONS_GENERAL
#define IDD_OPTIONS_CONNECTIONS
#define IDC_PREFS_FETCH_HANDLES
#define IDC_PREFS_FONT_MINSIZE
#define IDC_PREFS_NOANIMATION
#define IDC_PREFS_FONT_SIZE_SPIN
#define IDC_PREFS_PROXYNAME
#define IDD_OPTIONS_APPERANCE
#define IDC_PREFS_FANTASY
#define IDC_PREFS_FETCHERS_SPIN
#define IDC_PREFS_FETCH_HOST_SPIN
#define IDC_PREFS_FETCH_HANDLES_SPIN
#define IDC_PREFS_FONT_MINSIZE_SPIN
#define IDC_PREFS_FONTDEF
#define IDC_PREFS_REFERER
#define IDC_PREFS_HOMEPAGE
nserror netsurf_mkpath(char **str, size_t *size, size_t nelm,...)
Generate a path from one or more component elemnts.
Default operations table for files.
nserror nsoption_write(const char *path, struct nsoption_s *opts, struct nsoption_s *defs)
Write options that have changed from the defaults to a file.
Option reading and saving interface.
#define nsoption_charp(OPTION)
Get the value of a string option.
#define nsoption_int(OPTION)
Get the value of an integer option.
#define nsoption_set_int(OPTION, VALUE)
set an integer option in the default table
#define nsoption_set_bool(OPTION, VALUE)
set a boolean option in the default table
#define nsoption_set_charp(OPTION, VALUE)
set string option in default table
#define nsoption_bool(OPTION)
Get the value of a boolean option.
void win_perror(const char *lpszFunction)
#define LOG_WIN_MSG(h, m, w, l)
log windows message
char * G_config_path
path to where all user config files are held.
nserror win32_warning(const char *warning, const char *detail)
Warn the user of an event.
HINSTANCE hinst
win32 application instance handle.
static nserror text(const struct redraw_context *ctx, const struct plot_font_style *fstyle, int x, int y, const char *text, size_t length)
Text plotting.