Added some options dialog procedures.

svn path=/trunk/; revision=3201
This commit is contained in:
Robert Dickenson 2002-07-09 21:40:02 +00:00
parent b2afb794ec
commit 00bd48992d
7 changed files with 133 additions and 14 deletions

View file

@ -45,6 +45,7 @@
#include "main.h"
#include "about.h"
#include "dialogs.h"
#include "settings.h"
#include "utils.h"
#include "debug.h"
@ -76,4 +77,100 @@ BOOL CALLBACK ExecuteDialogWndProg(HWND hDlg, UINT message, WPARAM wParam, LPARA
}
BOOL CALLBACK ExecuteOptionsConfirmationWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
static struct ExecuteDialog* dlg;
int id;
switch (message) {
case WM_INITDIALOG:
dlg = (struct ExecuteDialog*) lParam;
Button_SetCheck(GetDlgItem(hDlg,IDC_CONFIRMATION_FILE_DELETE), Confirmation & CONFIRM_FILE_DELETE ? BST_CHECKED : BST_UNCHECKED);
Button_SetCheck(GetDlgItem(hDlg,IDC_CONFIRMATION_DIR_DELETE), Confirmation & CONFIRM_DIR_DELETE ? BST_CHECKED : BST_UNCHECKED);
Button_SetCheck(GetDlgItem(hDlg,IDC_CONFIRMATION_FILE_REPLACE), Confirmation & CONFIRM_FILE_REPLACE ? BST_CHECKED : BST_UNCHECKED);
Button_SetCheck(GetDlgItem(hDlg,IDC_CONFIRMATION_MOUSE_ACTIONS), Confirmation & CONFIRM_MOUSE_ACTIONS ? BST_CHECKED : BST_UNCHECKED);
Button_SetCheck(GetDlgItem(hDlg,IDC_CONFIRMATION_DISK_COMMANDS), Confirmation & CONFIRM_DISK_COMMANDS ? BST_CHECKED : BST_UNCHECKED);
Button_SetCheck(GetDlgItem(hDlg,IDC_CONFIRMATION_MODIFY_SYSTEM), Confirmation & CONFIRM_MODIFY_SYSTEM ? BST_CHECKED : BST_UNCHECKED);
return 1;
case WM_COMMAND:
id = (int)wParam;
if (id == IDOK) {
GetWindowText(GetDlgItem(hDlg, 201), dlg->cmd, MAX_PATH);
dlg->cmdshow = Button_GetState(GetDlgItem(hDlg,214))&BST_CHECKED?SW_SHOWMINIMIZED: SW_SHOWNORMAL;
if (Button_GetState(GetDlgItem(hDlg,IDC_CONFIRMATION_FILE_DELETE)) & BST_CHECKED)
Confirmation |= CONFIRM_FILE_DELETE;
else Confirmation &= ~CONFIRM_FILE_DELETE;
if (Button_GetState(GetDlgItem(hDlg,IDC_CONFIRMATION_DIR_DELETE)) & BST_CHECKED)
Confirmation |= CONFIRM_DIR_DELETE;
else Confirmation &= ~CONFIRM_DIR_DELETE;
if (Button_GetState(GetDlgItem(hDlg,IDC_CONFIRMATION_FILE_REPLACE)) & BST_CHECKED)
Confirmation |= CONFIRM_FILE_REPLACE;
else Confirmation &= ~CONFIRM_FILE_REPLACE;
if (Button_GetState(GetDlgItem(hDlg,IDC_CONFIRMATION_MOUSE_ACTIONS)) & BST_CHECKED)
Confirmation |= CONFIRM_MOUSE_ACTIONS;
else Confirmation &= ~CONFIRM_MOUSE_ACTIONS;
if (Button_GetState(GetDlgItem(hDlg,IDC_CONFIRMATION_DISK_COMMANDS)) & BST_CHECKED)
Confirmation |= CONFIRM_DISK_COMMANDS;
else Confirmation &= ~CONFIRM_DISK_COMMANDS;
if (Button_GetState(GetDlgItem(hDlg,IDC_CONFIRMATION_MODIFY_SYSTEM)) & BST_CHECKED)
Confirmation |= CONFIRM_MODIFY_SYSTEM;
else Confirmation &= ~CONFIRM_MODIFY_SYSTEM;
EndDialog(hDlg, id);
} else if (id == IDCANCEL)
EndDialog(hDlg, id);
return 1;
}
return 0;
}
BOOL CALLBACK ExecuteViewFileTypeWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
static struct ExecuteDialog* dlg;
int id;
switch (message) {
case WM_INITDIALOG:
dlg = (struct ExecuteDialog*)lParam;
Button_SetCheck(GetDlgItem(hDlg,IDC_VIEW_TYPE_DIRECTORIES), ViewType & VIEW_DIRECTORIES ? BST_CHECKED : BST_UNCHECKED);
Button_SetCheck(GetDlgItem(hDlg,IDC_VIEW_TYPE_PROGRAMS), ViewType & VIEW_PROGRAMS ? BST_CHECKED : BST_UNCHECKED);
Button_SetCheck(GetDlgItem(hDlg,IDC_VIEW_TYPE_DOCUMENTS), ViewType & VIEW_DOCUMENTS ? BST_CHECKED : BST_UNCHECKED);
Button_SetCheck(GetDlgItem(hDlg,IDC_VIEW_TYPE_OTHERS), ViewType & VIEW_OTHER ? BST_CHECKED : BST_UNCHECKED);
Button_SetCheck(GetDlgItem(hDlg,IDC_VIEW_TYPE_SYSFILES), ViewType & VIEW_SYSTEM ? BST_CHECKED : BST_UNCHECKED);
return 1;
case WM_COMMAND:
id = (int)wParam;
if (id == IDOK) {
GetWindowText(GetDlgItem(hDlg, 201), dlg->cmd, MAX_PATH);
dlg->cmdshow = Button_GetState(GetDlgItem(hDlg,214))&BST_CHECKED?SW_SHOWMINIMIZED: SW_SHOWNORMAL;
if (Button_GetState(GetDlgItem(hDlg,IDC_VIEW_TYPE_DIRECTORIES)) & BST_CHECKED)
ViewType |= VIEW_DIRECTORIES;
else ViewType &= ~VIEW_DIRECTORIES;
if (Button_GetState(GetDlgItem(hDlg,IDC_VIEW_TYPE_PROGRAMS)) & BST_CHECKED)
ViewType |= VIEW_PROGRAMS;
else ViewType &= ~VIEW_PROGRAMS;
if (Button_GetState(GetDlgItem(hDlg,IDC_VIEW_TYPE_DOCUMENTS)) & BST_CHECKED)
ViewType |= VIEW_DOCUMENTS;
else ViewType &= ~VIEW_DOCUMENTS;
if (Button_GetState(GetDlgItem(hDlg,IDC_VIEW_TYPE_OTHERS)) & BST_CHECKED)
ViewType |= VIEW_OTHER;
else ViewType &= ~VIEW_OTHER;
if (Button_GetState(GetDlgItem(hDlg,IDC_VIEW_TYPE_SYSFILES)) & BST_CHECKED)
ViewType |= VIEW_SYSTEM;
else ViewType &= ~VIEW_SYSTEM;
EndDialog(hDlg, id);
} else if (id == IDCANCEL)
EndDialog(hDlg, id);
return 1;
}
return 0;
}
/*
extern TCHAR ViewTypeMaskStr[MAX_TYPE_MASK_LEN];
*/

View file

@ -33,7 +33,6 @@ extern "C" {
#include "resource.h"
struct ExecuteDialog {
TCHAR cmd[MAX_PATH];
int cmdshow;
@ -41,6 +40,8 @@ struct ExecuteDialog {
BOOL CALLBACK ExecuteDialogWndProg(HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK ExecuteViewFileTypeWndProc(HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK ExecuteOptionsConfirmationWndProc(HWND, UINT, WPARAM, LPARAM);
#ifdef __cplusplus

View file

@ -411,20 +411,14 @@ LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case ID_VIEW_BY_FILE_TYPE:
{
struct ExecuteDialog dlg = {{0}};
if (DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_DIALOG_VIEW_TYPE), hWnd, ExecuteDialogWndProg, (LPARAM)&dlg) == IDOK) {
if (DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_DIALOG_VIEW_TYPE), hWnd, ExecuteViewFileTypeWndProc, (LPARAM)&dlg) == IDOK) {
}
}
break;
case ID_OPTIONS_CONFIRMATION:
/*
#define IDD_DIALOG_DIRECTORY 144
#define IDD_DIALOG_VIEW_TYPE 145
#define IDD_DIALOG_OPTIONS_CONFIRMATON 146
*/
{
struct ExecuteDialog dlg = {{0}};
if (DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_DIALOG_OPTIONS_CONFIRMATON), hWnd, ExecuteDialogWndProg, (LPARAM)&dlg) == IDOK) {
// ShellExecute(hWnd, _T("open")/*operation*/, dlg.cmd/*file*/, NULL/*parameters*/, NULL/*dir*/, dlg.cmdshow);
if (DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_DIALOG_OPTIONS_CONFIRMATON), hWnd, ExecuteOptionsConfirmationWndProc, (LPARAM)&dlg) == IDOK) {
}
}
break;

View file

@ -37,9 +37,10 @@
#define IDD_DIALOG_OPTIONS_CONFIRMATON 146
#define ID_WINDOW_CLOSE 798
#define ID_WINDOW_CLOSEALL 799
#define IDC_EDIT1 1000
#define IDC_VIEW_TYPE_MASK 999
#define IDC_FILE_MOVE_FROM 1000
#define IDC_VIEW_TYPE_DIRECTORIES 1001
#define IDC_EDIT2 1001
#define IDC_FILE_MOVE_TO 1001
#define IDC_VIEW_TYPE_PROGRAMS 1002
#define IDC_VIEW_TYPE_DOCUMENTS 1003
#define IDC_VIEW_TYPE_OTHERS 1004

View file

@ -35,4 +35,12 @@
#endif
#include "main.h"
#include "settings.h"
DWORD Confirmation;
DWORD ViewType;
TCHAR ViewTypeMaskStr[MAX_TYPE_MASK_LEN];
//LPCTSTR lpViewTypeMaskStr;

View file

@ -34,7 +34,25 @@ extern "C" {
#include "resource.h"
#define CONFIRM_FILE_DELETE 0x0001
#define CONFIRM_DIR_DELETE 0x0002
#define CONFIRM_FILE_REPLACE 0x0004
#define CONFIRM_MOUSE_ACTIONS 0x0008
#define CONFIRM_DISK_COMMANDS 0x0010
#define CONFIRM_MODIFY_SYSTEM 0x0020
#define VIEW_DIRECTORIES 0x0001
#define VIEW_PROGRAMS 0x0002
#define VIEW_DOCUMENTS 0x0004
#define VIEW_OTHER 0x0008
#define VIEW_SYSTEM 0x0010
#define MAX_TYPE_MASK_LEN 50
extern DWORD Confirmation;
extern DWORD ViewType;
extern TCHAR ViewTypeMaskStr[MAX_TYPE_MASK_LEN];
//extern LPCTSTR lpViewTypeMaskStr;

View file

@ -354,8 +354,8 @@ BEGIN
DEFPUSHBUTTON "OK",IDOK,211,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,211,24,50,14
LTEXT "Current Directory:",IDC_STATIC,7,7,54,10
EDITTEXT IDC_EDIT1,36,26,168,13,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT2,36,44,168,13,ES_AUTOHSCROLL
EDITTEXT IDC_FILE_MOVE_FROM,36,26,168,13,ES_AUTOHSCROLL
EDITTEXT IDC_FILE_MOVE_TO,36,44,168,13,ES_AUTOHSCROLL
LTEXT "From:",IDC_STATIC,7,28,27,9
LTEXT "To:",IDC_STATIC,7,48,23,9
LTEXT "",IDC_STATIC,65,7,139,12
@ -377,7 +377,7 @@ FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,104,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,104,24,50,14
EDITTEXT IDC_EDIT1,31,7,63,12,ES_AUTOHSCROLL
EDITTEXT IDC_VIEW_TYPE_MASK,31,7,63,12,ES_AUTOHSCROLL
GROUPBOX "File Type",IDC_STATIC,7,23,87,56
CONTROL "&Directories",IDC_VIEW_TYPE_DIRECTORIES,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,13,32,70,10