-2000-09-05 Brian Keener <bkeener@thesoftwaresource.com>
+2000-09-06 Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru>
+
+ * localdir.cc: new, local package directory selection dialog; cd
+ into selected directory
+ * Makefile.in (OBJS): add localdir.o
+ * dialog.h: add prototype for do_local_dir
+ * main.cc (WinMain): initialize local_dir to cwd; add call to
+ do_local_dir
+ * net.cc (dialog_cmd): make DO_LOCAL_DIR next dialog
+ * source.cc (dialog_cmd): ditto
+ * res.rc: add DO_LOCAL_DIR dialog; remove "current directory" from
+ presented choices in IDD_SOURCE; add IDS_ERR_CHDIR error string
+ * resource.h: defines for DO_LOCAL_DIR dialog; define IDS_ERR_CHDIR
+ * root.cc (dialog_cmd): make DO_LOCAL_DIR previous dialog
+ * state.h: add local_dir variable
+
+2000-09-06 Brian Keener <bkeener@thesoftwaresource.com>
* desktop.cc: added logic to handle to the new dialog and to
default the setting for the new checkboxes based on whether the
inilex.o \
iniparse.o \
install.o \
+ localdir.o \
log.o \
main.o \
mkdir.o \
D(do_fromcwd);
D(do_ini);
D(do_install);
+D(do_local_dir);
D(do_net);
D(do_other);
D(do_postinstall);
--- /dev/null
+/*
+ * Copyright (c) 2000, Red Hat, Inc.
+ *
+ * This program 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * A copy of the GNU General Public License can be found at
+ * http://www.gnu.org/
+ *
+ * Written by Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru>
+ * based on work and suggestions of DJ Delorie
+ *
+ */
+
+/* The purpose of this file is to ask the user where they want the
+ root of the installation to be, and to ask whether the user prefers
+ text or binary mounts. */
+
+static char *cvsid = "\n%%% $Id$\n";
+
+#include "win32.h"
+#include <shlobj.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+
+#include "dialog.h"
+#include "resource.h"
+#include "state.h"
+#include "msg.h"
+#include "mount.h"
+#include "concat.h"
+#include "log.h"
+
+static void
+check_if_enable_next (HWND h)
+{
+ EnableWindow (GetDlgItem (h, IDOK), local_dir != 0);
+}
+
+static void
+load_dialog (HWND h)
+{
+ eset (h, IDC_LOCAL_DIR, local_dir);
+ check_if_enable_next (h);
+}
+
+static void
+save_dialog (HWND h)
+{
+ local_dir = eget (h, IDC_LOCAL_DIR, local_dir);
+}
+
+
+static int CALLBACK
+browse_cb (HWND h, UINT msg, LPARAM lp, LPARAM data)
+{
+ switch (msg)
+ {
+ case BFFM_INITIALIZED:
+ if (local_dir)
+ SendMessage (h, BFFM_SETSELECTION, TRUE, (LPARAM)local_dir);
+ break;
+ }
+ return 0;
+}
+
+static void
+browse (HWND h)
+{
+ BROWSEINFO bi;
+ CHAR name[MAX_PATH];
+ LPITEMIDLIST pidl;
+ memset (&bi, 0, sizeof (bi));
+ bi.hwndOwner = h;
+ bi.pszDisplayName = name;
+ bi.lpszTitle = "Select download directory";
+ bi.ulFlags = BIF_RETURNONLYFSDIRS;
+ bi.lpfn = browse_cb;
+ pidl = SHBrowseForFolder (&bi);
+ if (pidl)
+ {
+ if (SHGetPathFromIDList (pidl, name))
+ eset (h, IDC_LOCAL_DIR, name);
+ }
+}
+
+
+static BOOL
+dialog_cmd (HWND h, int id, HWND hwndctl, UINT code)
+{
+ switch (id)
+ {
+
+ case IDC_LOCAL_DIR:
+ save_dialog (h);
+ check_if_enable_next (h);
+ break;
+
+ case IDC_LOCAL_DIR_BROWSE:
+ browse (h);
+ break;
+
+ case IDOK:
+ save_dialog (h);
+ if (SetCurrentDirectoryA (local_dir))
+ {
+ switch (source)
+ {
+ case IDC_SOURCE_DOWNLOAD:
+ NEXT (IDD_NET);
+ break;
+ case IDC_SOURCE_NETINST:
+ case IDC_SOURCE_CWD:
+ NEXT (IDD_ROOT);
+ break;
+ default:
+ NEXT (0);
+ break;
+ }
+ }
+ else
+ note (IDS_ERR_CHDIR, local_dir);
+
+ break;
+
+ case IDC_BACK:
+ save_dialog (h);
+ NEXT (IDD_SOURCE);
+ break;
+
+ case IDCANCEL:
+ NEXT (0);
+ break;
+ }
+}
+
+static BOOL CALLBACK
+dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ switch (message)
+ {
+ case WM_INITDIALOG:
+ load_dialog (h);
+ return FALSE;
+ case WM_COMMAND:
+ return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd);
+ }
+ return FALSE;
+}
+
+extern char cwd[_MAX_PATH];
+
+void
+do_local_dir (HINSTANCE h)
+{
+ int rv = 0;
+ rv = DialogBox (h, MAKEINTRESOURCE (IDD_LOCAL_DIR), 0, dialog_proc);
+ if (rv == -1)
+ fatal (IDS_DIALOG_FAILED);
+
+ log (0, "Selected local directory: %s", local_dir);
+}
+
char cwd[_MAX_PATH];
GetCurrentDirectory (sizeof (cwd), cwd);
+ local_dir = strdup (cwd);
log (0, "Current Directory: %s", cwd);
while (next_dialog)
{
case IDD_SPLASH: do_splash (h); break;
case IDD_SOURCE: do_source (h); break;
+ case IDD_LOCAL_DIR: do_local_dir (h); break;
case IDD_ROOT: do_root (h); break;
case IDD_NET: do_net (h); break;
case IDD_SITE: do_site (h); break;
switch (source)
{
case IDC_SOURCE_DOWNLOAD:
- NEXT (IDD_SOURCE);
+ NEXT (IDD_LOCAL_DIR);
break;
case IDC_SOURCE_NETINST:
case IDC_SOURCE_CWD:
DEFPUSHBUTTON "Next -->",IDOK,100,75,45,15,WS_DISABLED
PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15
ICON IDI_CYGWIN,-1,5,5,20,20
- CONTROL "Download from Internet to Current Directory",
+ CONTROL "Download from Internet",
IDC_SOURCE_DOWNLOAD,"Button",BS_AUTORADIOBUTTON,55,15,
152,10
CONTROL "Install from Internet",IDC_SOURCE_NETINST,"Button",
BS_AUTORADIOBUTTON,55,30,75,10
- CONTROL "Install from Current Directory",IDC_SOURCE_CWD,"Button",
+ CONTROL "Install from Local Directory",IDC_SOURCE_CWD,"Button",
BS_AUTORADIOBUTTON,55,45,104,10
END
+IDD_LOCAL_DIR DIALOG DISCARDABLE 0, 0, 215, 95
+STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Local package directory"
+FONT 8, "MS Sans Serif"
+BEGIN
+ DEFPUSHBUTTON "Next -->",IDOK,100,75,45,15
+ PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15
+ EDITTEXT IDC_LOCAL_DIR,55,25,127,12,ES_AUTOHSCROLL
+ LTEXT "Local Package Directory",IDC_STATIC,55,15,85,11
+ PUSHBUTTON "<-- Back",IDC_BACK,55,75,45,15
+ ICON IDI_CYGWIN,IDC_STATIC,5,5,20,20
+ PUSHBUTTON "Browse...",IDC_LOCAL_DIR_BROWSE,150,10,34,14
+END
+
IDD_ROOT DIALOG DISCARDABLE 0, 0, 215, 95
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Cygwin Setup"
IDS_NOLOGFILE "Cannot open log file %s for writing"
IDS_UNINSTALL_COMPLETE "Uninstalls complete."
IDS_WININET "Unable to find or load the Internet Explorer 5 DLLs"
+ IDS_ERR_CHDIR "Could not change dir to %s"
END
#endif // English (U.S.) resources
#define IDS_NOLOGFILE 20
#define IDS_UNINSTALL_COMPLETE 21
#define IDS_WININET 22
+#define IDS_ERR_CHDIR 23
#define IDD_ROOT 101
#define IDD_SOURCE 102
#define IDD_OTHER_URL 103
#define IDB_RTARROW 119
#define IDI_SPIN 120
#define IDI_CYGWIN 121
+#define IDD_LOCAL_DIR 122
#define IDC_SOURCE_DOWNLOAD 1000
#define IDC_SOURCE_NETINST 1001
#define IDC_SOURCE_CWD 1002
#define IDC_INS_ACTION 1040
#define IDC_ROOT_DESKTOP 1041
#define IDC_ROOT_MENU 1042
+#define IDC_LOCAL_DIR_BROWSE 1043
+#define IDC_LOCAL_DIR 1044
#define IDC_STATIC -1
// Next default values for new objects
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_3D_CONTROLS 1
-#define _APS_NEXT_RESOURCE_VALUE 122
+#define _APS_NEXT_RESOURCE_VALUE 123
#define _APS_NEXT_COMMAND_VALUE 40003
-#define _APS_NEXT_CONTROL_VALUE 1043
+#define _APS_NEXT_CONTROL_VALUE 1045
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
case IDC_BACK:
save_dialog (h);
- NEXT (IDD_SOURCE);
+ NEXT (IDD_LOCAL_DIR);
break;
case IDCANCEL:
case IDOK:
save_dialog (h);
- switch (source)
- {
- case IDC_SOURCE_DOWNLOAD:
- NEXT (IDD_NET);
- break;
- case IDC_SOURCE_NETINST:
- case IDC_SOURCE_CWD:
- NEXT (IDD_ROOT);
- break;
- }
+ NEXT (IDD_LOCAL_DIR);
break;
case IDC_BACK:
extern int source;
+extern char * local_dir;
+
extern char * root_dir;
extern int root_text;
extern int root_scope;