Author: aolk
Date: 2005-03-28 11:46:23 -0500 (Mon, 28 Mar 2005)
New Revision: 42309
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/OpenFileDialog.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SaveFileDialog.cs
Log:
* FileDialog.cs, SaveFileDialog.cs OpenFileDialog.cs:
- Added ReadOnly CheckBox
- Further refactoring: moved some code from Open-/SaveFileDialog
to FileDialog
2005-03-28 Alexander Olk <[EMAIL PROTECTED]>
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2005-03-28 15:46:19 UTC (rev 42308)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2005-03-28 16:46:23 UTC (rev 42309)
@@ -1,5 +1,13 @@
2005-03-28 Alexander Olk <[EMAIL PROTECTED]>
+ * FileDialog.cs, SaveFileDialog.cs OpenFileDialog.cs:
+
+ - Added ReadOnly CheckBox
+ - Further refactoring: moved some code from Open-/SaveFileDialog
+ to FileDialog
+
+2005-03-28 Alexander Olk <[EMAIL PROTECTED]>
+
* OpenFileDialog.cs: Fixed CheckFileExists
* FileDialog.cs:
Moved FileView and DirComboBox outside FileDialog class.
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs
2005-03-28 15:46:19 UTC (rev 42308)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs
2005-03-28 16:46:23 UTC (rev 42309)
@@ -50,7 +50,7 @@
internal FileDialogPanel fileDialogPanel;
private bool addExtension = true;
- private bool checkFileExists = false;
+ internal bool checkFileExists = false;
private bool checkPathExists = true;
private string defaultExt = "";
private bool dereferenceLinks = true;
@@ -64,13 +64,15 @@
private string title = "";
private bool validateNames = true;
+ //protected bool readOnlyChecked = false;
+
internal string openSaveButtonText;
internal string searchSaveLabelText;
- internal bool fileDialogShowReadOnly;
- internal bool fileDialogReadOnlyChecked;
- internal bool fileDialogMultiSelect;
- internal bool saveDialogCreatePrompt = false;
- internal bool saveDialogOverwritePrompt = true;
+ internal bool showReadOnly = false;
+ internal bool readOnlyChecked = false;
+ internal bool multiSelect = false;
+ internal bool createPrompt = false;
+ internal bool overwritePrompt = true;
private bool showHiddenFiles = false;
@@ -169,7 +171,7 @@
{
get
{
- if ( fileDialogMultiSelect )
+ if ( multiSelect )
return fileNames;
return null;
@@ -314,44 +316,45 @@
}
}
- internal bool FileDialogShowReadOnly
+ internal virtual bool ShowReadOnly
{
set
{
- fileDialogShowReadOnly = value;
+ showReadOnly = value;
fileDialogPanel.ResizeAndRelocateForHelpOrReadOnly( );
}
get
{
- return fileDialogShowReadOnly;
+ return showReadOnly;
}
}
- internal bool FileDialogReadOnlyChecked
+ internal virtual bool ReadOnlyChecked
{
set
{
- fileDialogReadOnlyChecked = value;
+ readOnlyChecked = value;
+ fileDialogPanel.CheckBox.Checked = value;
}
get
{
- return fileDialogReadOnlyChecked;
+ return readOnlyChecked;
}
}
- internal bool FileDialogMultiSelect
+ internal virtual bool Multiselect
{
set
{
- fileDialogMultiSelect = value;
+ multiSelect = value;
fileDialogPanel.MultiSelect = value;
}
get
{
- return fileDialogMultiSelect;
+ return multiSelect;
}
}
@@ -369,29 +372,29 @@
}
}
- internal bool SaveDialogCreatePrompt
+ internal virtual bool CreatePrompt
{
set
{
- saveDialogCreatePrompt = value;
+ createPrompt = value;
}
get
{
- return saveDialogCreatePrompt;
+ return createPrompt;
}
}
- internal bool SaveDialogOverwritePrompt
+ internal virtual bool OverwritePrompt
{
set
{
- saveDialogOverwritePrompt = value;
+ overwritePrompt = value;
}
get
{
- return saveDialogOverwritePrompt;
+ return overwritePrompt;
}
}
@@ -491,6 +494,7 @@
private ComboBox fileTypeComboBox;
private ImageList imageListTopToolbar;
private ContextMenu contextMenu;
+ private CheckBox checkBox;
internal FileDialog fileDialog;
@@ -540,6 +544,7 @@
imageListTopToolbar = new ImageList( );
menueToolBarButtonContextMenu = new
ContextMenu( );
contextMenu = new ContextMenu( );
+ checkBox = new CheckBox( );
SuspendLayout( );
@@ -560,6 +565,38 @@
searchSaveLabel.Text =
fileDialog.SearchSaveLabelText;
searchSaveLabel.TextAlign =
ContentAlignment.MiddleRight;
+ // dirComboBox
+ dirComboBox.Anchor = ( (AnchorStyles)( ( (
AnchorStyles.Top | AnchorStyles.Left ) | AnchorStyles.Right ) ) );
+ dirComboBox.DropDownStyle =
ComboBoxStyle.DropDownList;
+ dirComboBox.Location = new Point( 99, 8 );
+ dirComboBox.Size = new Size( 260, 21 );
+ dirComboBox.TabIndex = 1;
+
+ // smallButtonToolBar
+ smallButtonToolBar.Anchor = ( (AnchorStyles)( (
AnchorStyles.Top | AnchorStyles.Right ) ) );
+ smallButtonToolBar.Appearance =
ToolBarAppearance.Flat;
+ smallButtonToolBar.AutoSize = false;
+ smallButtonToolBar.Buttons.AddRange( new
ToolBarButton[] {
+
backToolBarButton,
+
upToolBarButton,
+
newdirToolBarButton,
+
menueToolBarButton} );
+ smallButtonToolBar.ButtonSize = new Size( 21,
16 ); // 21, 16
+ smallButtonToolBar.Divider = false;
+ smallButtonToolBar.Dock = DockStyle.None;
+ smallButtonToolBar.DropDownArrows = true;
+ smallButtonToolBar.ImageList =
imageListTopToolbar;
+ smallButtonToolBar.Location = new Point( 372, 8
);
+ smallButtonToolBar.ShowToolTips = true;
+ smallButtonToolBar.Size = new Size( 110, 20 );
+ smallButtonToolBar.TabIndex = 2;
+ smallButtonToolBar.TextAlign =
ToolBarTextAlign.Right;
+
+ // buttonPanel
+ buttonPanel.Dock = DockStyle.None;
+ buttonPanel.Location = new Point( 7, 37 );
+ buttonPanel.TabIndex = 3;
+
// mwfFileView
mwfFileView.Anchor = ( (AnchorStyles)( ( ( (
AnchorStyles.Top | AnchorStyles.Bottom ) | AnchorStyles.Left ) |
AnchorStyles.Right ) ) );
mwfFileView.Location = new Point( 99, 37 );
@@ -570,22 +607,15 @@
mwfFileView.Columns.Add( " Last Access", 150,
HorizontalAlignment.Left );
mwfFileView.AllowColumnReorder = true;
mwfFileView.MultiSelect = false;
- mwfFileView.TabIndex = 2;
+ mwfFileView.TabIndex = 4;
mwfFileView.FilterIndex =
fileDialog.FilterIndex;
- // dirComboBox
- dirComboBox.Anchor = ( (AnchorStyles)( ( (
AnchorStyles.Top | AnchorStyles.Left ) | AnchorStyles.Right ) ) );
- dirComboBox.DropDownStyle =
ComboBoxStyle.DropDownList;
- dirComboBox.Location = new Point( 99, 8 );
- dirComboBox.Size = new Size( 260, 21 );
- dirComboBox.TabIndex = 1;
-
// fileNameLabel
fileNameLabel.Anchor = ( (AnchorStyles)( (
AnchorStyles.Bottom | AnchorStyles.Left ) ) );
fileNameLabel.FlatStyle = FlatStyle.System;
fileNameLabel.Location = new Point( 102, 330 );
fileNameLabel.Size = new Size( 70, 21 );
- fileNameLabel.TabIndex = 6;
+ fileNameLabel.TabIndex = 5;
fileNameLabel.Text = "Filename:";
fileNameLabel.TextAlign =
ContentAlignment.MiddleLeft;
@@ -593,14 +623,14 @@
fileNameComboBox.Anchor = ( (AnchorStyles)( ( (
AnchorStyles.Bottom | AnchorStyles.Left ) | AnchorStyles.Right ) ) );
fileNameComboBox.Location = new Point( 195, 330
);
fileNameComboBox.Size = new Size( 245, 21 );
- fileNameComboBox.TabIndex = 4;
+ fileNameComboBox.TabIndex = 6;
// fileTypeLabel
fileTypeLabel.Anchor = ( (AnchorStyles)( (
AnchorStyles.Bottom | AnchorStyles.Left ) ) );
fileTypeLabel.FlatStyle = FlatStyle.System;
fileTypeLabel.Location = new Point( 102, 356 );
fileTypeLabel.Size = new Size( 70, 21 );
- fileTypeLabel.TabIndex = 5;
+ fileTypeLabel.TabIndex = 7;
fileTypeLabel.Text = "Filetype:";
fileTypeLabel.TextAlign =
ContentAlignment.MiddleLeft;
@@ -608,28 +638,8 @@
fileTypeComboBox.Anchor = ( (AnchorStyles)( ( (
AnchorStyles.Bottom | AnchorStyles.Left ) | AnchorStyles.Right ) ) );
fileTypeComboBox.Location = new Point( 195, 356
);
fileTypeComboBox.Size = new Size( 245, 21 );
- fileTypeComboBox.TabIndex = 6;
+ fileTypeComboBox.TabIndex = 8;
- // smallButtonToolBar
- smallButtonToolBar.Anchor = ( (AnchorStyles)( (
AnchorStyles.Top | AnchorStyles.Right ) ) );
- smallButtonToolBar.Appearance =
ToolBarAppearance.Flat;
- smallButtonToolBar.AutoSize = false;
- smallButtonToolBar.Buttons.AddRange( new
ToolBarButton[] {
-
backToolBarButton,
-
upToolBarButton,
-
newdirToolBarButton,
-
menueToolBarButton} );
- smallButtonToolBar.ButtonSize = new Size( 21,
16 ); // 21, 16
- smallButtonToolBar.Divider = false;
- smallButtonToolBar.Dock = DockStyle.None;
- smallButtonToolBar.DropDownArrows = true;
- smallButtonToolBar.ImageList =
imageListTopToolbar;
- smallButtonToolBar.Location = new Point( 372, 8
);
- smallButtonToolBar.ShowToolTips = true;
- smallButtonToolBar.Size = new Size( 110, 20 );
- smallButtonToolBar.TabIndex = 10;
- smallButtonToolBar.TextAlign =
ToolBarTextAlign.Right;
-
// backToolBarButton
backToolBarButton.ImageIndex = 0;
backToolBarButton.Enabled = false;
@@ -648,10 +658,6 @@
menueToolBarButton.DropDownMenu =
menueToolBarButtonContextMenu;
menueToolBarButton.Style =
ToolBarButtonStyle.DropDownButton;
- buttonPanel.Dock = DockStyle.None;
- buttonPanel.Location = new Point( 7, 37 );
- buttonPanel.TabIndex = 3;
-
// menueToolBarButtonContextMenu
MenuItem mi = new MenuItem( "Small Icon", new
EventHandler( OnClickMenuToolBarContextMenu ) );
menueToolBarButtonContextMenu.MenuItems.Add( mi
);
@@ -672,31 +678,43 @@
mwfFileView.ShowHiddenFiles =
fileDialog.ShowHiddenFiles;
contextMenu.MenuItems.Add( mi );
- // openButton
+ // openSaveButton
openSaveButton.Anchor = ( (AnchorStyles)( (
AnchorStyles.Bottom | AnchorStyles.Right ) ) );
openSaveButton.FlatStyle = FlatStyle.System;
openSaveButton.Location = new Point( 475, 330 );
openSaveButton.Size = new Size( 72, 21 );
- openSaveButton.TabIndex = 8;
+ openSaveButton.TabIndex = 9;
openSaveButton.Text =
fileDialog.OpenSaveButtonText;
+ openSaveButton.FlatStyle = FlatStyle.System;
// cancelButton
cancelButton.Anchor = ( (AnchorStyles)( (
AnchorStyles.Bottom | AnchorStyles.Right ) ) );
cancelButton.FlatStyle = FlatStyle.System;
cancelButton.Location = new Point( 475, 356 );
cancelButton.Size = new Size( 72, 21 );
- cancelButton.TabIndex = 9;
+ cancelButton.TabIndex = 10;
cancelButton.Text = "Cancel";
+ cancelButton.FlatStyle = FlatStyle.System;
// helpButton
helpButton.Anchor = ( (AnchorStyles)( (
AnchorStyles.Bottom | AnchorStyles.Right ) ) );
helpButton.FlatStyle = FlatStyle.System;
helpButton.Location = new Point( 475, 350 );
helpButton.Size = new Size( 72, 21 );
- helpButton.TabIndex = 10;
+ helpButton.TabIndex = 11;
helpButton.Text = "Help";
+ helpButton.FlatStyle = FlatStyle.System;
helpButton.Hide( );
+ // checkBox
+ checkBox.Anchor = ( (AnchorStyles)( ( (
AnchorStyles.Bottom | AnchorStyles.Left ) | AnchorStyles.Right ) ) );
+ checkBox.Text = "Open Readonly";
+ checkBox.Location = new Point( 195, 350 );
+ checkBox.Size = new Size( 245, 21 );
+ checkBox.FlatStyle = FlatStyle.System;
+ checkBox.TabIndex = 12;
+ checkBox.Hide( );
+
ClientSize = new Size( 554, 405 ); // 384
ContextMenu = contextMenu;
@@ -713,6 +731,7 @@
Controls.Add( dirComboBox );
Controls.Add( searchSaveLabel );
Controls.Add( buttonPanel );
+ Controls.Add( checkBox );
ResumeLayout( false );
@@ -747,6 +766,8 @@
mwfFileView.SelectedFilesChanged += new
EventHandler( OnSelectedFilesChangedFileView );
dirComboBox.DirectoryChanged += new
EventHandler( OnDirectoryChangedDirComboBox );
+
+ checkBox.CheckedChanged += new EventHandler(
OnCheckCheckChanged );
}
public ComboBox FileNameComboBox
@@ -802,6 +823,19 @@
}
}
+ public CheckBox CheckBox
+ {
+ set
+ {
+ checkBox = value;
+ }
+
+ get
+ {
+ return checkBox;
+ }
+ }
+
void OnClickContextMenu( object sender, EventArgs e )
{
MenuItem senderMenuItem = sender as MenuItem;
@@ -848,7 +882,7 @@
}
else // FileDialogType == SaveFileDialog
{
- if (
fileDialog.SaveDialogOverwritePrompt )
+ if ( fileDialog.OverwritePrompt
)
{
if ( File.Exists(
currentFileName ) )
{
@@ -864,7 +898,7 @@
}
}
- if (
fileDialog.SaveDialogCreatePrompt )
+ if ( fileDialog.CreatePrompt )
{
if ( !File.Exists(
currentFileName ) )
{
@@ -1087,6 +1121,11 @@
ChangeDirectory( sender,
dirComboBox.CurrentPath );
}
+ void OnCheckCheckChanged( object sender, EventArgs e )
+ {
+ fileDialog.ReadOnlyChecked = checkBox.Checked;
+ }
+
public void UpdateFilters( )
{
ArrayList filters =
fileDialog.FileFilter.FilterArrayList;
@@ -1148,7 +1187,7 @@
public void ResizeAndRelocateForHelpOrReadOnly( )
{
- if ( fileDialog.ShowHelp ||
fileDialog.FileDialogShowReadOnly )
+ if ( fileDialog.ShowHelp ||
fileDialog.ShowReadOnly )
{
mwfFileView.Size = new Size( 449, 250 );
fileNameLabel.Location = new Point(
102, 298 );
@@ -1171,6 +1210,9 @@
if ( fileDialog.ShowHelp )
helpButton.Show( );
+
+ if ( fileDialog.ShowReadOnly )
+ checkBox.Show( );
}
internal class ButtonPanel : Panel
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/OpenFileDialog.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/OpenFileDialog.cs
2005-03-28 15:46:19 UTC (rev 42308)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/OpenFileDialog.cs
2005-03-28 16:46:23 UTC (rev 42309)
@@ -34,11 +34,6 @@
{
public class OpenFileDialog : FileDialog
{
- private bool multiSelect = false;
- private bool readOnlyChecked = false;
- private bool showReadOnly = false;
- private bool checkFileExists = true;
-
#region Public Constructors
public OpenFileDialog( )
{
@@ -50,8 +45,7 @@
SearchSaveLabelText = "Search in:";
- FileDialogShowReadOnly = showReadOnly;
- FileDialogReadOnlyChecked = readOnlyChecked;
+ checkFileExists = true;
fileDialogType = FileDialogType.OpenFileDialog;
@@ -73,7 +67,7 @@
}
}
- public bool Multiselect
+ public new bool Multiselect
{
get
{
@@ -82,12 +76,11 @@
set
{
- multiSelect = value;
- FileDialogMultiSelect = value;
+ base.Multiselect = value;
}
}
- public bool ReadOnlyChecked
+ public new bool ReadOnlyChecked
{
get
{
@@ -96,12 +89,11 @@
set
{
- readOnlyChecked = value;
- FileDialogReadOnlyChecked = readOnlyChecked;
+ base.ReadOnlyChecked = value;
}
}
- public bool ShowReadOnly
+ public new bool ShowReadOnly
{
get
{
@@ -110,8 +102,7 @@
set
{
- showReadOnly = value;
- FileDialogShowReadOnly = value;
+ base.ShowReadOnly = value;
}
}
@@ -133,9 +124,9 @@
multiSelect = false;
checkFileExists = true;
readOnlyChecked = false;
- FileDialogReadOnlyChecked = readOnlyChecked;
+ ReadOnlyChecked = readOnlyChecked;
showReadOnly = false;
- FileDialogShowReadOnly = showReadOnly;
+ ShowReadOnly = showReadOnly;
}
[MonoTODO]
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SaveFileDialog.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SaveFileDialog.cs
2005-03-28 15:46:19 UTC (rev 42308)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SaveFileDialog.cs
2005-03-28 16:46:23 UTC (rev 42309)
@@ -34,9 +34,6 @@
{
public sealed class SaveFileDialog : FileDialog
{
- private bool createPrompt = false;
- private bool overwritePrompt = true;
-
#region Public Constructors
public SaveFileDialog( )
{
@@ -55,12 +52,11 @@
#endregion // Public Constructors
#region Public Instance Properties
- public bool CreatePrompt
+ public new bool CreatePrompt
{
set
{
- createPrompt = value;
- SaveDialogCreatePrompt = createPrompt;
+ base.CreatePrompt = value;
}
get
@@ -69,12 +65,11 @@
}
}
- public bool OverwritePrompt
+ public new bool OverwritePrompt
{
set
{
- overwritePrompt = value;
- SaveDialogOverwritePrompt = overwritePrompt;
+ base.OverwritePrompt = value;
}
get
@@ -99,8 +94,8 @@
base.Reset( );
overwritePrompt = true;
createPrompt = false;
- SaveDialogOverwritePrompt = overwritePrompt;
- SaveDialogCreatePrompt = createPrompt;
+ OverwritePrompt = overwritePrompt;
+ CreatePrompt = createPrompt;
}
[MonoTODO]
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches