15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* ***** BEGIN LICENSE BLOCK ***** 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Version: MPL 1.1/GPL 2.0/LGPL 2.1 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The contents of this file are subject to the Mozilla Public License Version 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 1.1 (the "License"); you may not use this file except in compliance with 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the License. You may obtain a copy of the License at 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * http://www.mozilla.org/MPL/ 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Software distributed under the License is distributed on an "AS IS" basis, 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * for the specific language governing rights and limitations under the 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * License. 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The Original Code is mozilla.org code. 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The Initial Developer of the Original Code is 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Netscape Communications Corporation. 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Portions created by the Initial Developer are Copyright (C) 1998 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the Initial Developer. All Rights Reserved. 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Contributor(s): 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Alternatively, the contents of this file may be used under the terms of 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * either the GNU General Public License Version 2 or later (the "GPL"), or 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * in which case the provisions of the GPL or the LGPL are applicable instead 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * of those above. If you wish to allow use of your version of this file only 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * under the terms of either the GPL or the LGPL, and not to allow others to 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * use your version of this file under the terms of the MPL, indicate your 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * decision by deleting the provisions above and replace them with the notice 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * and other provisions required by the GPL or the LGPL. If you do not delete 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the provisions above, a recipient may use your version of this file under 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the terms of any one of the MPL, the GPL or the LGPL. 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * ***** END LICENSE BLOCK ***** */ 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "xp.h" 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <windowsx.h> 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "windowsxx.h" 425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "resource.h" 445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "logger.h" 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)static void onApply(HWND hWnd) 475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles){ 485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Logger * logger = (Logger *)GetWindowLong(hWnd, DWL_USER); 495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) if(!logger) 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) return; 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) logger->bSPALID = (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_SPALID)); 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) logger->bSaveSettings = TRUE; 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)static void onNotify(HWND hWnd, int idCtrl, LPNMHDR lpNMHdr) 575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles){ 585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) switch(lpNMHdr->code) 595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) { 605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) case PSN_RESET: 615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) break; 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) case PSN_APPLY: 635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) onApply(hWnd); 645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) break; 655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) 695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles){ 705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Logger * logger = NULL; 715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) if(lParam) 735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) { 745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) logger = (Logger *)(((PROPSHEETPAGE *)lParam)->lParam); 755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) SetWindowLong(hWnd, DWL_USER, (long)logger); 765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) if(logger) 795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) { 805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) CheckDlgButton(hWnd, IDC_CHECK_SPALID, logger->bSPALID ? BST_CHECKED : BST_UNCHECKED); 815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) return TRUE; 845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)BOOL CALLBACK AdvancedPageProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) 875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles){ 885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) switch(msg) 895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) { 905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) case WM_INITDIALOG: 915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) return (BOOL)HANDLE_WM_INITDIALOG(hWnd, wParam, lParam, onInitDialog); 925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) case WM_NOTIFY: 935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) HANDLE_WM_NOTIFY(hWnd, wParam, lParam, onNotify); 945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) break; 955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) default: 975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) return FALSE; 985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) return TRUE; 1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 101