UPD: Many different improvements (patch by Denis Bisson)

This commit is contained in:
Alexander Koblov 2015-01-11 11:33:38 +00:00
commit 2de10efdc9
23 changed files with 1484 additions and 971 deletions

View file

@ -294,6 +294,7 @@ procedure SetStringsFromArray(Strings: TStrings; const anArray: TDynamicStringAr
procedure SetValue(var anArray: TDynamicStringArray; Key, NewValue: String);
procedure SetValue(var anArray: TDynamicStringArray; Key: String; NewValue: Boolean);
function ShortcutsToText(const Shortcuts: TDynamicStringArray): String;
function GetDateTimeInStrEZSortable(DateTime:TDateTime):string;
implementation
@ -1057,5 +1058,17 @@ begin
Result := ArrayToString(Shortcuts, ' ');
end;
{ GetDateTimeInStrEZSortable: Return the date and time in string format with YYYY-MM-DD@HH-MM-SS
so it can be integrate in a filename. Also, because of the order of the terms, it make it
useful when things are sorted BECAUSE it will also sort by date/time at the same time}
function GetDateTimeInStrEZSortable(DateTime:TDateTime):string;
var
MyYear, MyMonth, MyDay, MyHour, MyMin, MySec, MyMilSec: word;
begin
DecodeDate(DateTime, MyYear, MyMonth, MyDay);
DecodeTime(DateTime, MyHour, MyMin, MySec, MyMilSec);
result:=Format('%d-%2.2d-%2.2d@%2.2d-%2.2d-%2.2d', [MyYear, MyMonth, MyDay, MyHour, MyMin, MySec]);
end;
end.

View file

@ -141,40 +141,44 @@ begin
// new function was added to explicitly initialize instance.
InitInstance;
if IsInstanceAllowed then
begin
if (log_start_shutdown in gLogOptions) then logWrite('Program start ('+GetCurrentUserName+'/'+GetComputerNetName+')');
begin
if (log_start_shutdown in gLogOptions) then logWrite('Program start ('+GetCurrentUserName+'/'+GetComputerNetName+')');
InitPasswordStore;
LoadPixMapManager;
Application.CreateForm(TfrmMain, frmMain); // main form
Application.CreateForm(TdmHighl, dmHighl); // highlighters
Application.CreateForm(TdmComData, dmComData); // common data
Application.CreateForm(TdmHelpManager, dmHelpMgr); // help manager
Application.CreateForm(TfrmMkDir, frmMkDir); // 21.05.2009 - makedir form
InitPasswordStore;
LoadPixMapManager;
Application.CreateForm(TfrmMain, frmMain); // main form
Application.CreateForm(TdmHighl, dmHighl); // highlighters
Application.CreateForm(TdmComData, dmComData); // common data
Application.CreateForm(TdmHelpManager, dmHelpMgr); // help manager
Application.CreateForm(TfrmMkDir, frmMkDir); // 21.05.2009 - makedir form
{$IF DEFINED(LCLGTK2) AND (lcl_fullversion >= 093100)}
// LCLGTK2 uses Application.MainForm as the clipboard widget, however our
// MainForm is TfrmHackForm and it never gets realized. GTK2 doesn't
// seem to allow a not realized widget to have clipboard ownership.
// We switch to frmMain instead which will be realized at some point.
GTK2WidgetSet.SetClipboardWidget(PGtkWidget(frmMain.Handle));
{$ENDIF}
{$IF DEFINED(LCLGTK2) AND (lcl_fullversion >= 093100)}
// LCLGTK2 uses Application.MainForm as the clipboard widget, however our
// MainForm is TfrmHackForm and it never gets realized. GTK2 doesn't
// seem to allow a not realized widget to have clipboard ownership.
// We switch to frmMain instead which will be realized at some point.
GTK2WidgetSet.SetClipboardWidget(PGtkWidget(frmMain.Handle));
{$ENDIF}
// Hooking on QT needs the handle of the main form which is created
// in Application.CreateForm above.
uKeyboard.HookKeyboardLayoutChanged;
// Hooking on QT needs the handle of the main form which is created
// in Application.CreateForm above.
uKeyboard.HookKeyboardLayoutChanged;
//We may now remove the starting splash screen, mot of the application has been started now
frmStartingSplash.Close;
frmStartingSplash.Release;
//We may now remove the starting splash screen, mot of the application has been started now
frmStartingSplash.Close;
frmStartingSplash.Release;
Application.Run;
if (log_start_shutdown in gLogOptions) then logWrite('Program shutdown ('+GetCurrentUserName+'/'+GetComputerNetName+')');
end
Application.Run;
if not UniqueInstance.isAnotherDCRunningWhileIamRunning then
DeleteTempFolderDeletableAtTheEnd;
if (log_start_shutdown in gLogOptions) then logWrite('Program shutdown ('+GetCurrentUserName+'/'+GetComputerNetName+')');
end
else
begin
DCDebug('Another instance of DC is already running. Exiting.');
end;
begin
DCDebug('Another instance of DC is already running. Exiting.');
end;
uKeyboard.CleanupKeyboard;
DCDebug('Finished Double Commander');

View file

@ -788,8 +788,6 @@ var
FlagKeepGoing: boolean = False;
ActionDispatcher: integer;
BackupPath: string;
MyYear, MyMonth, MyDay, MyHour, MyMin, MySec, MyMilSec: word;
FreezeTime: TDateTime;
WorkingDirectoryHotlist: TDirectoryHotlist;
Answer: integer;
begin
@ -824,13 +822,7 @@ begin
BackupPath := IncludeTrailingPathDelimiter(mbExpandFileName(EnvVarConfigPath)) + 'Backup';
if mbForceDirectory(BackupPath) then
begin
FreezeTime := now;
DecodeDate(Freezetime, MyYear, MyMonth, MyDay);
DecodeTime(FreezeTime, MyHour, MyMin, MySec, MyMilSec);
SaveDialog.Filename :=
BackupPath + DirectorySeparator + 'Backup_' +
Format('%d-%2.2d-%2.2d@%2.2d-%2.2d-%2.2d', [MyYear, MyMonth, MyDay,
MyHour, MyMin, MySec]) + '.hotlist';
SaveDialog.Filename := BackupPath + DirectorySeparator + 'Backup_' +GetDateTimeInStrEZSortable(now) + '.hotlist';
if gDirectoryHotlist.ExportDoubleCommander(SaveDialog.FileName, True) then
msgOK(Format(rsMsgHotDirTotalBackuped, [gDirectoryHotlist.Count, SaveDialog.Filename]))
else
@ -1957,4 +1949,4 @@ end;
{ TODO -oDB : Be able to add a quick 16x16 icon to some friendly shortcut like a little star or something to help to see a special entry. }
{ TODO -oDB : Would be nice to have also a COPY-and-PASTE in addition to CUT-and-PASTE. Also, make sure to create new THotDir entry, not just copy entries in tree otherwise it's not good. }
end.

View file

@ -1,13 +1,125 @@
inherited frmOptionsDragDrop: TfrmOptionsDragDrop
Width = 454
ClientWidth = 454
DesignTop = 20
Height = 467
Width = 845
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ClientHeight = 467
ClientWidth = 845
DesignLeft = 65
DesignTop = 245
object cbShowConfirmationDialog: TCheckBox[0]
Left = 8
Height = 20
Height = 24
Top = 8
Width = 194
Width = 270
Caption = '&Show confirmation dialog after drop'
OnChange = GenericSomethingChanged
TabOrder = 0
end
object gbTextDragAndDropRelatedOptions: TGroupBox[1]
AnchorSideLeft.Control = cbShowConfirmationDialog
AnchorSideTop.Control = cbShowConfirmationDialog
AnchorSideTop.Side = asrBottom
Left = 8
Height = 238
Top = 44
Width = 617
AutoSize = True
BorderSpacing.Top = 12
Caption = 'When drag && dropping text into panels:'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ClientHeight = 219
ClientWidth = 613
TabOrder = 1
Visible = False
object lblMostDesiredTextFormat1: TLabel
Left = 6
Height = 17
Top = 6
Width = 410
Caption = 'Place the most desired format on top of list (use dag && drop):'
ParentColor = False
end
object lblMostDesiredTextFormat2: TLabel
AnchorSideLeft.Control = lblMostDesiredTextFormat1
AnchorSideTop.Control = lblMostDesiredTextFormat1
AnchorSideTop.Side = asrBottom
Left = 6
Height = 17
Top = 23
Width = 449
Caption = '(if the most desired is not present, we''ll take second one and so on)'
ParentColor = False
end
object lbMostDesiredTextFormat: TListBox
AnchorSideLeft.Control = lblMostDesiredTextFormat1
AnchorSideTop.Control = lblMostDesiredTextFormat2
AnchorSideTop.Side = asrBottom
Left = 6
Height = 72
Top = 40
Width = 208
DragMode = dmAutomatic
Items.Strings = (
'Rich test'
'HTML text'
'Unicode text'
'ANSI text'
)
ItemHeight = 23
OnDragDrop = lbMostDesiredTextFormatDragDrop
OnDragOver = lbMostDesiredTextFormatDragOver
ScrollWidth = 190
TabOrder = 0
end
object cbDragAndDropAskFormatEachTime: TCheckBox
AnchorSideLeft.Control = lblMostDesiredTextFormat1
AnchorSideTop.Control = lbMostDesiredTextFormat
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 112
Width = 454
Caption = 'From all the supported formats, ask which one to use every time'
OnChange = GenericSomethingChanged
TabOrder = 1
end
object cbDragAndDropTextAutoFilename: TCheckBox
AnchorSideLeft.Control = lblMostDesiredTextFormat1
AnchorSideTop.Control = lblWarningForAskFormat
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 165
Width = 601
BorderSpacing.Top = 12
Caption = 'When dropping text, generate filename automatically (otherwise will prompt the user)'
OnChange = GenericSomethingChanged
TabOrder = 2
end
object cbDragAndDropSaveUnicodeTextInUFT8: TCheckBox
AnchorSideLeft.Control = lblMostDesiredTextFormat1
AnchorSideTop.Control = cbDragAndDropTextAutoFilename
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 189
Width = 522
Caption = 'When saving Unicode text, save it in UTF8 format (will be UTF16 otherwise)'
OnChange = GenericSomethingChanged
TabOrder = 3
end
object lblWarningForAskFormat: TLabel
AnchorSideLeft.Control = lblMostDesiredTextFormat1
AnchorSideTop.Control = cbDragAndDropAskFormatEachTime
AnchorSideTop.Side = asrBottom
Left = 6
Height = 17
Top = 136
Width = 489
Caption = '(will not work with some source application, so try to uncheck if problem)'
ParentColor = False
end
end
end

View file

@ -1 +1,8 @@
TFRMOPTIONSDRAGDROP.CBSHOWCONFIRMATIONDIALOG.CAPTION=&Show confirmation dialog after drop
TFRMOPTIONSDRAGDROP.GBTEXTDRAGANDDROPRELATEDOPTIONS.CAPTION=When drag && dropping text into panels:
TFRMOPTIONSDRAGDROP.LBLMOSTDESIREDTEXTFORMAT1.CAPTION=Place the most desired format on top of list (use dag && drop):
TFRMOPTIONSDRAGDROP.LBLMOSTDESIREDTEXTFORMAT2.CAPTION=(if the most desired is not present, we'll take second one and so on)
TFRMOPTIONSDRAGDROP.CBDRAGANDDROPASKFORMATEACHTIME.CAPTION=From all the supported formats, ask which one to use every time
TFRMOPTIONSDRAGDROP.CBDRAGANDDROPTEXTAUTOFILENAME.CAPTION=When dropping text, generate filename automatically (otherwise will prompt the user)
TFRMOPTIONSDRAGDROP.CBDRAGANDDROPSAVEUNICODETEXTINUFT8.CAPTION=When saving Unicode text, save it in UTF8 format (will be UTF16 otherwise)
TFRMOPTIONSDRAGDROP.LBLWARNINGFORASKFORMAT.CAPTION=(will not work with some source application, so try to uncheck if problem)

View file

@ -27,7 +27,7 @@ unit fOptionsDragDrop;
interface
uses
Classes, SysUtils, StdCtrls,
Controls, Classes, SysUtils, StdCtrls,
fOptionsFrame;
type
@ -36,31 +36,65 @@ type
TfrmOptionsDragDrop = class(TOptionsEditor)
cbShowConfirmationDialog: TCheckBox;
cbDragAndDropAskFormatEachTime: TCheckBox;
cbDragAndDropSaveUnicodeTextInUFT8: TCheckBox;
cbDragAndDropTextAutoFilename: TCheckBox;
gbTextDragAndDropRelatedOptions: TGroupBox;
lblMostDesiredTextFormat1: TLabel;
lblMostDesiredTextFormat2: TLabel;
lblWarningForAskFormat: TLabel;
lbMostDesiredTextFormat: TListBox;
procedure lbMostDesiredTextFormatDragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
procedure lbMostDesiredTextFormatDragDrop(Sender, Source: TObject; X,
Y: Integer);
procedure GenericSomethingChanged(Sender: TObject);
protected
FModificationTookPlace: boolean;
procedure Load; override;
function Save: TOptionsEditorSaveFlags; override;
procedure LoadDesiredOrderTextFormatList;
procedure SaveDesiredOrderTextFormatList;
public
class function GetIconIndex: Integer; override;
class function GetTitle: String; override;
function CanWeClose(var WillNeedUpdateWindowView: boolean): boolean; override;
end;
procedure SortThisListAccordingToDragAndDropDesiredFormat(ListToSort:TStringList);
implementation
{$R *.lfm}
uses
uGlobs, uLng;
fOptions, uShowMsg, uGlobs, uLng;
{ TfrmOptionsDragDrop }
procedure TfrmOptionsDragDrop.Load;
begin
cbShowConfirmationDialog.Checked := gShowDialogOnDragDrop;
{$IFDEF MSWINDOWS}
gbTextDragAndDropRelatedOptions.Visible:=TRUE;
LoadDesiredOrderTextFormatList;
cbDragAndDropAskFormatEachTime.Checked := gDragAndDropAskFormatEachTime;
cbDragAndDropTextAutoFilename.Checked := gDragAndDropTextAutoFilename;
cbDragAndDropSaveUnicodeTextInUFT8.Checked := gDragAndDropSaveUnicodeTextInUFT8;
{$ENDIF}
FModificationTookPlace := False;
end;
function TfrmOptionsDragDrop.Save: TOptionsEditorSaveFlags;
begin
gShowDialogOnDragDrop := cbShowConfirmationDialog.Checked;
{$IFDEF MSWINDOWS}
SaveDesiredOrderTextFormatList;
gDragAndDropAskFormatEachTime := cbDragAndDropAskFormatEachTime.Checked;
gDragAndDropTextAutoFilename := cbDragAndDropTextAutoFilename.Checked;
gDragAndDropSaveUnicodeTextInUFT8 := cbDragAndDropSaveUnicodeTextInUFT8.Checked;
{$ENDIF}
FModificationTookPlace := False;
Result := [];
end;
@ -74,5 +108,129 @@ begin
Result := rsOptionsEditorDragAndDrop;
end;
procedure TfrmOptionsDragDrop.lbMostDesiredTextFormatDragOver(Sender,
Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
begin
Accept := (Source = lbMostDesiredTextFormat) and (lbMostDesiredTextFormat.ItemIndex <> -1);
end;
procedure TfrmOptionsDragDrop.lbMostDesiredTextFormatDragDrop(Sender, Source: TObject; X, Y: Integer);
var
SrcIndex, DestIndex: Integer;
begin
SrcIndex := lbMostDesiredTextFormat.ItemIndex;
if SrcIndex = -1 then
Exit;
DestIndex := lbMostDesiredTextFormat.GetIndexAtY(Y);
if (DestIndex < 0) or (DestIndex >= lbMostDesiredTextFormat.Count) then
DestIndex := lbMostDesiredTextFormat.Count - 1;
lbMostDesiredTextFormat.Items.Move(SrcIndex, DestIndex);
lbMostDesiredTextFormat.ItemIndex := DestIndex;
FModificationTookPlace := True;
end;
procedure TfrmOptionsDragDrop.GenericSomethingChanged(Sender: TObject);
begin
FModificationTookPlace := True;
end;
procedure TfrmOptionsDragDrop.LoadDesiredOrderTextFormatList;
var
IndexDropTextFormat, ExpectedPosition, ActualPosition:integer;
TempoString: string;
begin
lbMostDesiredTextFormat.Clear;
for IndexDropTextFormat:=0 to pred(NbOfDropTextFormat) do
lbMostDesiredTextFormat.Items.Add(gDragAndDropDesiredTextFormat[IndexDropTextFormat].Name);
for IndexDropTextFormat:=0 to pred(NbOfDropTextFormat) do
begin
ExpectedPosition:=gDragAndDropDesiredTextFormat[IndexDropTextFormat].DesireLevel;
if (ExpectedPosition<0) OR (ExpectedPosition>pred(NbOfDropTextFormat)) then ExpectedPosition:=pred(NbOfDropTextFormat);
ActualPosition:=lbMostDesiredTextFormat.Items.IndexOf(gDragAndDropDesiredTextFormat[IndexDropTextFormat].Name);
if (ActualPosition<>-1) AND (ExpectedPosition<>ActualPosition) then
begin
TempoString:=lbMostDesiredTextFormat.Items.Strings[ActualPosition];
lbMostDesiredTextFormat.Items.Strings[ActualPosition]:=lbMostDesiredTextFormat.Items.Strings[ExpectedPosition];
lbMostDesiredTextFormat.Items.Strings[ExpectedPosition]:=TempoString;
end;
end;
end;
procedure TfrmOptionsDragDrop.SaveDesiredOrderTextFormatList;
var
IndexDropTextFormat, ActualPosition:integer;
TempoString: string;
begin
for IndexDropTextFormat:=0 to pred(NbOfDropTextFormat) do
begin
ActualPosition:=lbMostDesiredTextFormat.Items.IndexOf(gDragAndDropDesiredTextFormat[IndexDropTextFormat].Name);
if (ActualPosition<>-1) then gDragAndDropDesiredTextFormat[IndexDropTextFormat].DesireLevel:=ActualPosition;
end;
end;
function TfrmOptionsDragDrop.CanWeClose(var WillNeedUpdateWindowView: boolean): boolean;
var
Answer: TMyMsgResult;
begin
Result := not FModificationTookPlace;
if not Result then
begin
ShowOptions(TfrmOptionsDragDrop);
Answer := MsgBox(rsMsgDragAndDropModifiedWantToSave, [msmbYes, msmbNo, msmbCancel], msmbCancel, msmbCancel);
case Answer of
mmrYes:
begin
Save;
Result := True;
end;
mmrNo: Result := True;
else
Result := False;
end;
end;
end;
// Arrange the list in such way that the most desired format is on top.
// This routine is also used in "uOleDragDrop" for offering user's suggestion so the list is arranged according to user's desire
procedure SortThisListAccordingToDragAndDropDesiredFormat(ListToSort:TStringList);
function GetDesireLevel(SearchingText:string):integer;
var
SearchingIndex:integer;
begin
result:=-1;
SearchingIndex:=0;
while (SearchingIndex<NbOfDropTextFormat) AND (result=-1) do
begin
if gDragAndDropDesiredTextFormat[SearchingIndex].Name=SearchingText then result:=gDragAndDropDesiredTextFormat[SearchingIndex].DesireLevel;
inc(SearchingIndex);
end;
end;
var
Index, InnerIndex, DesireLevelIndex, DesireLevelInnerIndex : integer;
TempoString : string;
begin
//It's a poor sort... But we don't have too many so we keep it simple.
for Index:=0 to (ListToSort.Count-2) do
begin
for InnerIndex:=Index+1 to pred(ListToSort.Count) do
begin
DesireLevelIndex:=GetDesireLevel(ListToSort.Strings[Index]);
DesireLevelInnerIndex:=GetDesireLevel(ListToSort.Strings[InnerIndex]);
if (DesireLevelIndex>DesireLevelInnerIndex) AND (DesireLevelIndex<>-1) AND (DesireLevelInnerIndex<>-1) then
begin
TempoString:=ListToSort.Strings[Index];
ListToSort.Strings[Index]:=ListToSort.Strings[InnerIndex];
ListToSort.Strings[InnerIndex]:=TempoString;
end;
end;
end;
end;
end.

View file

@ -3,34 +3,38 @@ inherited frmOptionsFileOperations: TfrmOptionsFileOperations
Width = 734
ClientHeight = 602
ClientWidth = 734
DesignTop = 27
DesignLeft = 156
DesignTop = 261
object gbUserInterface: TGroupBox[0]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Control = gbExecutingOperations
AnchorSideRight.Side = asrBottom
Left = 6
Height = 299
Height = 284
Top = 6
Width = 722
Width = 716
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Around = 6
Caption = 'User interface'
ChildSizing.LeftRightSpacing = 10
ChildSizing.TopBottomSpacing = 4
ChildSizing.TopBottomSpacing = 10
ChildSizing.HorizontalSpacing = 4
ChildSizing.VerticalSpacing = 4
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 276
ClientWidth = 718
ClientHeight = 266
ClientWidth = 712
TabOrder = 0
object lblProgressKind: TLabel
AnchorSideLeft.Control = gbUserInterface
AnchorSideTop.Control = cbProgressKind
AnchorSideTop.Side = asrCenter
Left = 10
Height = 18
Top = 4
Width = 371
Height = 15
Top = 14
Width = 190
BorderSpacing.Bottom = 10
Caption = 'Show operations progress &initially in'
FocusControl = cbProgressKind
@ -39,103 +43,137 @@ inherited frmOptionsFileOperations: TfrmOptionsFileOperations
object cbProgressKind: TComboBox
AnchorSideLeft.Control = lblProgressKind
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = lblProgressKind
AnchorSideTop.Side = asrCenter
AnchorSideTop.Control = gbUserInterface
AnchorSideRight.Control = gbUserInterface
AnchorSideRight.Side = asrBottom
Left = 385
Height = 30
Top = -2
Width = 316
Left = 204
Height = 23
Top = 10
Width = 498
Anchors = [akTop, akLeft, akRight]
ItemHeight = 0
ItemHeight = 15
OnChange = GenericSomethingChanged
Style = csDropDownList
TabOrder = 0
end
object cbDropReadOnlyFlag: TCheckBox
AnchorSideLeft.Control = lblProgressKind
AnchorSideTop.Control = cbProgressKind
AnchorSideTop.Side = asrBottom
Left = 10
Height = 23
Top = 32
Width = 371
Height = 19
Top = 37
Width = 118
Caption = 'D&rop readonly flag'
OnChange = GenericSomethingChanged
TabOrder = 1
end
object cbRenameSelOnlyName: TCheckBox
AnchorSideLeft.Control = lblProgressKind
AnchorSideTop.Control = cbDropReadOnlyFlag
AnchorSideTop.Side = asrBottom
Left = 10
Height = 23
Top = 59
Width = 371
Height = 19
Top = 60
Width = 286
Caption = 'Select &file name without extension when renaming'
OnChange = GenericSomethingChanged
TabOrder = 2
end
object cbShowCopyTabSelectPanel: TCheckBox
AnchorSideLeft.Control = lblProgressKind
AnchorSideTop.Control = cbRenameSelOnlyName
AnchorSideTop.Side = asrBottom
Left = 10
Height = 23
Top = 86
Width = 371
Height = 19
Top = 83
Width = 247
Caption = 'Sho&w tab select panel in copy/move dialog'
OnChange = GenericSomethingChanged
TabOrder = 3
end
object cbDeleteToTrash: TCheckBox
AnchorSideLeft.Control = lblProgressKind
AnchorSideTop.Control = cbShowCopyTabSelectPanel
AnchorSideTop.Side = asrBottom
Left = 10
Height = 23
Top = 113
Width = 371
Height = 19
Top = 106
Width = 289
Caption = 'Dele&te to recycle bin (Shift key reverses this setting)'
OnChange = cbDeleteToTrashChange
TabOrder = 4
end
object bvlConfirmations: TBevel
AnchorSideLeft.Control = gbUserInterface
AnchorSideLeft.Control = lblProgressKind
AnchorSideTop.Control = cbDeleteToTrash
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = gbUserInterface
AnchorSideRight.Side = asrBottom
Left = 10
Height = 2
Top = 140
Width = 698
Top = 137
Width = 692
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 12
end
object lblConfirmations: TLabel
AnchorSideLeft.Control = lblProgressKind
AnchorSideTop.Control = bvlConfirmations
AnchorSideTop.Side = asrBottom
Left = 10
Height = 18
Top = 146
Width = 371
Height = 15
Top = 149
Width = 167
BorderSpacing.Top = 10
Caption = 'Show confirmation window for:'
ParentColor = False
end
object cbCopyConfirmation: TCheckBox
AnchorSideLeft.Control = lblProgressKind
AnchorSideTop.Control = lblConfirmations
AnchorSideTop.Side = asrBottom
Left = 10
Height = 23
Height = 19
Top = 168
Width = 371
Width = 102
Caption = 'Cop&y operation'
TabOrder = 5
end
object cbMoveConfirmation: TCheckBox
AnchorSideLeft.Control = lblProgressKind
AnchorSideTop.Control = cbCopyConfirmation
AnchorSideTop.Side = asrBottom
Left = 10
Height = 23
Top = 195
Width = 371
Height = 19
Top = 191
Width = 104
Caption = '&Move operation'
OnChange = GenericSomethingChanged
TabOrder = 6
end
object cbDeleteConfirmation: TCheckBox
AnchorSideLeft.Control = lblProgressKind
AnchorSideTop.Control = cbMoveConfirmation
AnchorSideTop.Side = asrBottom
Left = 10
Height = 23
Top = 222
Width = 371
Height = 19
Top = 214
Width = 107
Caption = '&Delete operation'
OnChange = GenericSomethingChanged
TabOrder = 7
end
object cbDeleteToTrashConfirmation: TCheckBox
AnchorSideLeft.Control = lblProgressKind
AnchorSideTop.Control = cbDeleteConfirmation
AnchorSideTop.Side = asrBottom
Left = 10
Height = 23
Top = 249
Width = 371
Height = 19
Top = 237
Width = 150
Caption = 'D&elete to trash operation'
OnChange = GenericSomethingChanged
TabOrder = 8
end
end
@ -146,27 +184,30 @@ inherited frmOptionsFileOperations: TfrmOptionsFileOperations
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 137
Top = 311
Height = 213
Top = 296
Width = 722
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Around = 6
Caption = 'Executing operations'
ChildSizing.LeftRightSpacing = 10
ChildSizing.TopBottomSpacing = 4
ChildSizing.TopBottomSpacing = 10
ChildSizing.HorizontalSpacing = 4
ChildSizing.VerticalSpacing = 4
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 114
ClientHeight = 195
ClientWidth = 718
TabOrder = 1
object lblBufferSize: TLabel
AnchorSideLeft.Control = gbExecutingOperations
AnchorSideTop.Control = edtBufferSize
AnchorSideTop.Side = asrCenter
Left = 10
Height = 18
Top = 4
Width = 393
Height = 15
Top = 14
Width = 191
BorderSpacing.Bottom = 10
Caption = '&Buffer size for file operations (in KB):'
FocusControl = edtBufferSize
@ -175,20 +216,24 @@ inherited frmOptionsFileOperations: TfrmOptionsFileOperations
object edtBufferSize: TEdit
AnchorSideLeft.Control = lblBufferSize
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = lblBufferSize
AnchorSideTop.Side = asrCenter
AnchorSideTop.Control = gbExecutingOperations
AnchorSideBottom.Side = asrCenter
Left = 407
Height = 28
Top = -1
Left = 205
Height = 23
Top = 10
Width = 80
OnChange = GenericSomethingChanged
TabOrder = 0
end
object lblWipePassNumber: TLabel
AnchorSideLeft.Control = lblBufferSize
AnchorSideTop.Control = seWipePassNumber
AnchorSideTop.Side = asrCenter
AnchorSideBottom.Side = asrBottom
Left = 10
Height = 18
Top = 32
Width = 393
Height = 15
Top = 41
Width = 126
BorderSpacing.Bottom = 10
Caption = '&Number of wipe passes:'
FocusControl = seWipePassNumber
@ -197,30 +242,65 @@ inherited frmOptionsFileOperations: TfrmOptionsFileOperations
object seWipePassNumber: TSpinEdit
AnchorSideLeft.Control = lblWipePassNumber
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = lblWipePassNumber
AnchorSideTop.Side = asrCenter
Left = 407
Height = 28
Top = 27
AnchorSideTop.Control = edtBufferSize
AnchorSideTop.Side = asrBottom
Left = 140
Height = 23
Top = 37
Width = 50
OnChange = GenericSomethingChanged
TabOrder = 1
end
object cbProcessComments: TCheckBox
AnchorSideLeft.Control = lblBufferSize
AnchorSideTop.Control = seWipePassNumber
AnchorSideTop.Side = asrBottom
Left = 10
Height = 23
Top = 60
Width = 393
Height = 19
Top = 64
Width = 211
Caption = '&Process comments with files/folders'
TabOrder = 2
end
object cbSkipFileOpError: TCheckBox
AnchorSideLeft.Control = lblBufferSize
AnchorSideTop.Control = cbProcessComments
AnchorSideTop.Side = asrBottom
Left = 10
Height = 23
Height = 19
Top = 87
Width = 393
Width = 315
Caption = 'S&kip file operations errors and write them to log window'
OnChange = GenericSomethingChanged
TabOrder = 3
end
object rgTypeOfDuplicatedRename: TRadioGroup
AnchorSideLeft.Control = lblBufferSize
AnchorSideTop.Control = cbSkipFileOpError
AnchorSideTop.Side = asrBottom
Left = 10
Height = 75
Top = 110
Width = 315
AutoFill = True
Caption = 'Duplicated name auto-rename style:'
ChildSizing.LeftRightSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 57
ClientWidth = 311
Items.Strings = (
'DC legacy - Copy (x) filename.ext'
'Windows - filename (x).ext'
'Other - filename(x).ext'
)
OnSelectionChanged = GenericSomethingChanged
TabOrder = 4
end
end
object gbFileSearch: TGroupBox[2]
AnchorSideLeft.Control = Owner
@ -229,8 +309,8 @@ inherited frmOptionsFileOperations: TfrmOptionsFileOperations
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 112
Top = 454
Height = 95
Top = 515
Width = 722
Anchors = [akTop, akLeft, akRight]
AutoSize = True
@ -240,17 +320,18 @@ inherited frmOptionsFileOperations: TfrmOptionsFileOperations
ChildSizing.TopBottomSpacing = 4
ChildSizing.HorizontalSpacing = 4
ChildSizing.VerticalSpacing = 4
ClientHeight = 89
ClientHeight = 77
ClientWidth = 718
TabOrder = 2
object rbUseMmapInSearch: TRadioButton
AnchorSideLeft.Control = gbFileSearch
AnchorSideTop.Control = gbFileSearch
Left = 10
Height = 23
Height = 19
Top = 4
Width = 308
Width = 252
Caption = 'Use memory mapping for search te&xt in files'
OnChange = GenericSomethingChanged
TabOrder = 0
end
object rbUseStreamInSearch: TRadioButton
@ -258,12 +339,13 @@ inherited frmOptionsFileOperations: TfrmOptionsFileOperations
AnchorSideTop.Control = rbUseMmapInSearch
AnchorSideTop.Side = asrBottom
Left = 10
Height = 23
Top = 33
Width = 245
Height = 19
Top = 29
Width = 192
BorderSpacing.Top = 6
Caption = '&Use stream for search text in files'
Checked = True
OnChange = GenericSomethingChanged
TabOrder = 1
TabStop = True
end
@ -272,11 +354,12 @@ inherited frmOptionsFileOperations: TfrmOptionsFileOperations
AnchorSideTop.Control = rbUseStreamInSearch
AnchorSideTop.Side = asrBottom
Left = 10
Height = 23
Top = 62
Width = 201
Height = 19
Top = 54
Width = 163
BorderSpacing.Top = 6
Caption = '&Search for part of file name'
OnChange = GenericSomethingChanged
TabOrder = 2
end
end

View file

@ -14,6 +14,7 @@ TFRMOPTIONSFILEOPERATIONS.LBLBUFFERSIZE.CAPTION=&Buffer size for file operations
TFRMOPTIONSFILEOPERATIONS.LBLWIPEPASSNUMBER.CAPTION=&Number of wipe passes:
TFRMOPTIONSFILEOPERATIONS.CBPROCESSCOMMENTS.CAPTION=&Process comments with files/folders
TFRMOPTIONSFILEOPERATIONS.CBSKIPFILEOPERROR.CAPTION=S&kip file operations errors and write them to log window
TFRMOPTIONSFILEOPERATIONS.RGTYPEOFDUPLICATEDRENAME.CAPTION=Duplicated name auto-rename style:
TFRMOPTIONSFILEOPERATIONS.GBFILESEARCH.CAPTION=File search
TFRMOPTIONSFILEOPERATIONS.RBUSEMMAPINSEARCH.CAPTION=Use memory mapping for search te&xt in files
TFRMOPTIONSFILEOPERATIONS.RBUSESTREAMINSEARCH.CAPTION=&Use stream for search text in files

View file

@ -59,9 +59,12 @@ type
rbUseMmapInSearch: TRadioButton;
rbUseStreamInSearch: TRadioButton;
seWipePassNumber: TSpinEdit;
rgTypeOfDuplicatedRename: TRadioGroup;
procedure cbDeleteToTrashChange(Sender: TObject);
procedure GenericSomethingChanged(Sender: TObject);
private
FLoading: Boolean;
FModificationTookPlace: Boolean;
protected
procedure Init; override;
procedure Load; override;
@ -70,6 +73,7 @@ type
constructor Create(TheOwner: TComponent); override;
class function GetIconIndex: Integer; override;
class function GetTitle: String; override;
function CanWeClose(var WillNeedUpdateWindowView: boolean): boolean; override;
end;
implementation
@ -77,7 +81,7 @@ implementation
{$R *.lfm}
uses
DCStrUtils, uGlobs, uLng, fOptionsHotkeys;
fOptions, uShowMsg, DCStrUtils, uGlobs, uLng, fOptionsHotkeys;
{ TfrmOptionsFileOperations }
@ -105,6 +109,7 @@ begin
HotkeysEditor := OptionsDialog.GetEditor(TfrmOptionsHotkeys);
if Assigned(HotkeysEditor) then
(HotkeysEditor as TfrmOptionsHotkeys).AddDeleteWithShiftHotkey(cbDeleteToTrash.Checked);
GenericSomethingChanged(Sender);
end;
end;
@ -133,8 +138,10 @@ begin
cbMoveConfirmation.Checked := focMove in gFileOperationsConfirmations;
cbDeleteConfirmation.Checked := focDelete in gFileOperationsConfirmations;
cbDeleteToTrashConfirmation.Checked := focDeleteToTrash in gFileOperationsConfirmations;
rgTypeOfDuplicatedRename.ItemIndex := Integer(gTypeOfDuplicatedRename);
FLoading := False;
FModificationTookPlace := False;
end;
function TfrmOptionsFileOperations.Save: TOptionsEditorSaveFlags;
@ -167,6 +174,8 @@ begin
Include(gFileOperationsConfirmations, focDelete);
if cbDeleteToTrashConfirmation.Checked then
Include(gFileOperationsConfirmations, focDeleteToTrash);
gTypeOfDuplicatedRename := tDuplicatedRename(rgTypeOfDuplicatedRename.ItemIndex);
FModificationTookPlace := False;
end;
constructor TfrmOptionsFileOperations.Create(TheOwner: TComponent);
@ -175,5 +184,34 @@ begin
FLoading := False;
end;
procedure TfrmOptionsFileOperations.GenericSomethingChanged(Sender: TObject);
begin
FModificationTookPlace := True;
end;
function TfrmOptionsFileOperations.CanWeClose(var WillNeedUpdateWindowView: boolean): boolean;
var
Answer: TMyMsgResult;
begin
Result := not FModificationTookPlace;
if not Result then
begin
ShowOptions(TfrmOptionsFileOperations);
Answer := MsgBox(rsMsgFileOperationsModifiedWantToSave, [msmbYes, msmbNo, msmbCancel], msmbCancel, msmbCancel);
case Answer of
mmrYes:
begin
Save;
Result := True;
end;
mmrNo: Result := True;
else
Result := False;
end;
end;
end;
end.

View file

@ -14,7 +14,7 @@ inherited frmOptionsMisc: TfrmOptionsMisc
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 193
Height = 182
Top = 6
Width = 707
Anchors = [akTop, akLeft, akRight]
@ -22,35 +22,37 @@ inherited frmOptionsMisc: TfrmOptionsMisc
BorderSpacing.Around = 6
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6
ClientHeight = 189
ClientHeight = 164
ClientWidth = 703
TabOrder = 0
object chkShowWarningMessages: TCheckBox
Left = 12
Height = 24
Height = 19
Top = 6
Width = 312
Width = 251
Caption = 'Show &warning messages ("OK" button only)'
OnClick = GenericSomethingChanged
TabOrder = 0
end
object chkThumbSave: TCheckBox
AnchorSideTop.Control = dblThumbnails
AnchorSideTop.Side = asrBottom
Left = 12
Height = 24
Top = 91
Width = 191
Height = 19
Top = 79
Width = 154
BorderSpacing.Top = 4
Caption = '&Save thumbnails in cache'
OnClick = GenericSomethingChanged
TabOrder = 2
end
object lblThumbSize: TLabel
AnchorSideTop.Control = speThumbWidth
AnchorSideTop.Side = asrCenter
Left = 12
Height = 17
Top = 126
Width = 103
Height = 15
Top = 108
Width = 83
Caption = '&Thumbnail size:'
FocusControl = speThumbWidth
ParentColor = False
@ -62,8 +64,8 @@ inherited frmOptionsMisc: TfrmOptionsMisc
AnchorSideRight.Control = gbExtended
AnchorSideRight.Side = asrBottom
Left = 12
Height = 17
Top = 70
Height = 15
Top = 60
Width = 679
Caption = 'Thumbnails'
Anchors = [akTop, akLeft, akRight]
@ -75,14 +77,15 @@ inherited frmOptionsMisc: TfrmOptionsMisc
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = chkThumbSave
AnchorSideTop.Side = asrBottom
Left = 121
Height = 27
Top = 121
Left = 101
Height = 23
Top = 104
Width = 50
BorderSpacing.Left = 6
BorderSpacing.Top = 6
MaxValue = 512
MinValue = 16
OnChange = GenericSomethingChanged
TabOrder = 3
Value = 16
end
@ -90,13 +93,14 @@ inherited frmOptionsMisc: TfrmOptionsMisc
AnchorSideLeft.Control = lblThumbSeparator
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = speThumbWidth
Left = 192
Height = 27
Top = 121
Left = 170
Height = 23
Top = 104
Width = 50
BorderSpacing.Left = 6
MaxValue = 512
MinValue = 16
OnChange = GenericSomethingChanged
TabOrder = 4
Value = 16
end
@ -105,10 +109,10 @@ inherited frmOptionsMisc: TfrmOptionsMisc
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = speThumbWidth
AnchorSideTop.Side = asrCenter
Left = 177
Height = 17
Top = 126
Width = 9
Left = 157
Height = 15
Top = 108
Width = 7
BorderSpacing.Left = 6
Caption = 'X'
ParentColor = False
@ -118,10 +122,10 @@ inherited frmOptionsMisc: TfrmOptionsMisc
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = speThumbWidth
AnchorSideTop.Side = asrCenter
Left = 248
Height = 17
Top = 126
Width = 40
Left = 226
Height = 15
Top = 108
Width = 29
BorderSpacing.Left = 6
Caption = 'pixels'
ParentColor = False
@ -130,9 +134,9 @@ inherited frmOptionsMisc: TfrmOptionsMisc
AnchorSideTop.Control = speThumbWidth
AnchorSideTop.Side = asrBottom
Left = 12
Height = 29
Top = 154
Width = 321
Height = 25
Top = 133
Width = 271
AutoSize = True
BorderSpacing.Top = 6
Caption = '&Remove thumbnails for no longer existing files'
@ -143,11 +147,12 @@ inherited frmOptionsMisc: TfrmOptionsMisc
AnchorSideTop.Control = chkShowWarningMessages
AnchorSideTop.Side = asrBottom
Left = 12
Height = 24
Top = 34
Width = 379
Height = 19
Top = 29
Width = 304
BorderSpacing.Top = 4
Caption = 'Always &go to the root of a drive when changing drives'
OnClick = GenericSomethingChanged
TabOrder = 1
end
end
@ -158,14 +163,14 @@ inherited frmOptionsMisc: TfrmOptionsMisc
AnchorSideRight.Control = gbExtended
AnchorSideRight.Side = asrBottom
Left = 6
Height = 116
Top = 211
Height = 103
Top = 200
Width = 707
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Top = 12
Caption = 'Regarding TC export/import:'
ClientHeight = 97
ClientHeight = 85
ClientWidth = 703
TabOrder = 1
TabStop = True
@ -175,10 +180,10 @@ inherited frmOptionsMisc: TfrmOptionsMisc
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = gbTCExportImport
AnchorSideRight.Control = btnRelativeTCExecutableFile
Left = 177
Height = 27
Left = 162
Height = 23
Top = 4
Width = 469
Width = 484
DialogOptions = [ofPathMustExist, ofFileMustExist]
Filter = 'executables|*.exe|any files|*.*'
FilterIndex = 1
@ -191,6 +196,7 @@ inherited frmOptionsMisc: TfrmOptionsMisc
BorderSpacing.Bottom = 4
MaxLength = 0
TabOrder = 0
OnChange = GenericSomethingChanged
end
object btnRelativeTCExecutableFile: TSpeedButton
AnchorSideLeft.Side = asrBottom
@ -201,7 +207,7 @@ inherited frmOptionsMisc: TfrmOptionsMisc
Left = 670
Height = 24
Hint = 'Some functions to select appropriate path'
Top = 5
Top = 3
Width = 24
Anchors = [akTop, akRight]
BorderSpacing.Left = 24
@ -249,9 +255,9 @@ inherited frmOptionsMisc: TfrmOptionsMisc
AnchorSideRight.Control = lblTCPathForTool
AnchorSideRight.Side = asrBottom
Left = -586
Height = 17
Top = 9
Width = 757
Height = 15
Top = 8
Width = 742
Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight]
Caption = 'TC executable:'
@ -263,10 +269,10 @@ inherited frmOptionsMisc: TfrmOptionsMisc
AnchorSideTop.Control = fneTCExecutableFilename
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 177
Height = 27
Top = 35
Width = 444
Left = 162
Height = 23
Top = 31
Width = 459
DialogOptions = [ofPathMustExist, ofFileMustExist]
Filter = 'ini configuration file|*.ini|any file|*.*'
FilterIndex = 1
@ -279,16 +285,17 @@ inherited frmOptionsMisc: TfrmOptionsMisc
BorderSpacing.Bottom = 4
MaxLength = 0
TabOrder = 1
OnChange = GenericSomethingChanged
end
object lblTCConfig: TLabel
AnchorSideTop.Control = fneTCConfigFilename
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = lblTCPathForTool
AnchorSideRight.Side = asrBottom
Left = 51
Height = 17
Top = 40
Width = 120
Left = 60
Height = 15
Top = 35
Width = 96
Anchors = [akTop, akRight]
Caption = 'Configuration file:'
ParentColor = False
@ -301,7 +308,7 @@ inherited frmOptionsMisc: TfrmOptionsMisc
Left = 645
Height = 24
Hint = 'Some functions to select appropriate path'
Top = 36
Top = 30
Width = 24
BorderSpacing.Left = 24
Glyph.Data = {
@ -350,7 +357,7 @@ inherited frmOptionsMisc: TfrmOptionsMisc
Left = 670
Height = 24
Hint = 'View log file content'
Top = 36
Top = 30
Width = 24
BorderSpacing.Left = 1
Glyph.Data = {
@ -389,24 +396,25 @@ inherited frmOptionsMisc: TfrmOptionsMisc
AnchorSideTop.Control = fneTCConfigFilename
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = btnOutputPathForToolbar
Left = 177
Height = 27
Top = 66
Width = 461
Left = 162
Height = 23
Top = 58
Width = 476
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 4
BorderSpacing.Bottom = 4
OnChange = GenericSomethingChanged
TabOrder = 2
end
object lblTCPathForTool: TLabel
AnchorSideTop.Control = edOutputPathForToolbar
AnchorSideTop.Side = asrCenter
AnchorSideRight.Side = asrBottom
Left = 32
Height = 17
Top = 71
Width = 139
Left = 46
Height = 15
Top = 62
Width = 110
Anchors = [akTop]
Caption = 'Toolbar output path:'
ParentColor = False
@ -417,8 +425,8 @@ inherited frmOptionsMisc: TfrmOptionsMisc
AnchorSideBottom.Control = edOutputPathForToolbar
AnchorSideBottom.Side = asrBottom
Left = 638
Height = 27
Top = 66
Height = 23
Top = 58
Width = 32
Anchors = [akTop, akRight, akBottom]
BorderSpacing.InnerBorder = 4
@ -434,9 +442,9 @@ inherited frmOptionsMisc: TfrmOptionsMisc
AnchorSideBottom.Control = edOutputPathForToolbar
AnchorSideBottom.Side = asrBottom
Left = 670
Height = 27
Height = 23
Hint = 'Some functions to select appropriate path'
Top = 66
Top = 58
Width = 24
Anchors = [akTop, akRight, akBottom]
Glyph.Data = {

View file

@ -65,12 +65,16 @@ type
procedure btnViewConfigFileClick(Sender: TObject);
procedure btnOutputPathForToolbarClick(Sender: TObject);
procedure btnRelativeOutputPathForToolbarClick(Sender: TObject);
procedure GenericSomethingChanged(Sender: TObject);
private
FModificationTookPlace: Boolean;
protected
procedure Load; override;
function Save: TOptionsEditorSaveFlags; override;
public
class function GetIconIndex: Integer; override;
class function GetTitle: String; override;
function CanWeClose(var WillNeedUpdateWindowView: boolean): boolean; override;
end;
procedure BringUsToTCConfigurationPage;
@ -80,7 +84,7 @@ implementation
{$R *.lfm}
uses
fOptions, Forms, Dialogs, fMain, Controls, uSpecialDir, uShowForm,
uShowMsg, fOptions, Forms, Dialogs, fMain, Controls, uSpecialDir, uShowForm,
uGlobs, uLng, uThumbnails;
{ TfrmOptionsMisc }
@ -117,6 +121,7 @@ begin
fneTCConfigFilename.DialogTitle := rsMsgLocateTCConfiguation;
gSpecialDirList.PopulateMenuWithSpecialDir(pmPathHelper, mp_PATHHELPER, nil);
{$ENDIF}
FModificationTookPlace := False;
end;
function TfrmOptionsMisc.Save: TOptionsEditorSaveFlags;
@ -132,6 +137,7 @@ begin
gTotalCommanderConfigFilename := fneTCConfigFilename.FileName;
gTotalCommanderToolbarPath := edOutputPathForToolbar.Text;
{$ENDIF}
FModificationTookPlace := False;
end;
{ TfrmOptionsMisc.btnRelativeTCExecutableFileClick }
@ -176,6 +182,39 @@ begin
pmPathHelper.PopUp(Mouse.CursorPos.X, Mouse.CursorPos.Y);
end;
{ TfrmOptionsMisc.GenericSomethingChanged }
procedure TfrmOptionsMisc.GenericSomethingChanged(Sender: TObject);
begin
FModificationTookPlace := True;
end;
{ TfrmOptionsMisc.CanWeClose }
function TfrmOptionsMisc.CanWeClose(var WillNeedUpdateWindowView: boolean): boolean;
var
Answer: TMyMsgResult;
begin
Result := not FModificationTookPlace;
if not Result then
begin
ShowOptions(TfrmOptionsMisc);
Answer := MsgBox(rsMsgMiscellaneousModifiedWantToSave, [msmbYes, msmbNo, msmbCancel], msmbCancel, msmbCancel);
case Answer of
mmrYes:
begin
Save;
Result := True;
end;
mmrNo: Result := True;
else
Result := False;
end;
end;
end;
procedure BringUsToTCConfigurationPage;
var
Editor: TOptionsEditor;

View file

@ -12,7 +12,7 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 105
Height = 99
Top = 0
Width = 838
Anchors = [akTop, akLeft, akRight]
@ -22,7 +22,7 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
Caption = 'Appearance'
ChildSizing.LeftRightSpacing = 8
ChildSizing.TopBottomSpacing = 4
ClientHeight = 86
ClientHeight = 81
ClientWidth = 834
TabOrder = 0
object lblBarSize: TLabel
@ -30,9 +30,9 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideTop.Control = trbBarSize
AnchorSideTop.Side = asrCenter
Left = 8
Height = 17
Top = 19
Width = 56
Height = 15
Top = 20
Width = 42
Caption = '&Bar size:'
FocusControl = trbBarSize
ParentColor = False
@ -42,7 +42,7 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = trbBarSize
AnchorSideTop.Side = asrCenter
Left = 66
Left = 52
Height = 1
Top = 27
Width = 1
@ -53,7 +53,7 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideLeft.Control = lblBarSizeValue
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = gbGroupBox
Left = 70
Left = 56
Height = 46
Top = 4
Width = 150
@ -72,10 +72,10 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = trbIconSize
AnchorSideTop.Side = asrCenter
Left = 235
Height = 17
Top = 19
Width = 61
Left = 221
Height = 15
Top = 20
Width = 48
BorderSpacing.Left = 15
Caption = 'Icon si&ze:'
FocusControl = trbIconSize
@ -86,7 +86,7 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = trbIconSize
AnchorSideTop.Side = asrCenter
Left = 298
Left = 271
Height = 1
Top = 27
Width = 1
@ -98,7 +98,7 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = gbGroupBox
AnchorSideBottom.Side = asrBottom
Left = 302
Left = 275
Height = 46
Top = 4
Width = 150
@ -119,9 +119,9 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideTop.Control = trbIconSize
AnchorSideTop.Side = asrBottom
Left = 8
Height = 24
Height = 19
Top = 58
Width = 108
Width = 83
BorderSpacing.Top = 8
Caption = '&Flat buttons'
Checked = True
@ -133,12 +133,13 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideLeft.Control = cbFlatButtons
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = cbFlatButtons
Left = 128
Height = 24
Left = 103
Height = 19
Top = 58
Width = 227
Width = 177
BorderSpacing.Left = 12
Caption = 'Report errors with commands'
OnChange = GenericSomethingChanged
TabOrder = 3
end
end
@ -149,15 +150,15 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = pnlEditToolbar
Left = 6
Height = 29
Top = 229
Height = 25
Top = 248
Width = 838
Anchors = [akLeft, akRight, akBottom]
AutoSize = True
BorderSpacing.Top = 2
BorderSpacing.Bottom = 2
BevelOuter = bvNone
ClientHeight = 29
ClientHeight = 25
ClientWidth = 838
TabOrder = 1
object pnlToolbarButtons: TPanel
@ -165,10 +166,10 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = pnlFullToolbarButtons
AnchorSideBottom.Side = asrBottom
Left = 150
Height = 29
Left = 156
Height = 25
Top = 0
Width = 539
Width = 527
AutoSize = True
BevelOuter = bvNone
ChildSizing.HorizontalSpacing = 8
@ -178,52 +179,52 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
ChildSizing.ShrinkVertical = crsHomogenousChildResize
ChildSizing.Layout = cclTopToBottomThenLeftToRight
ChildSizing.ControlsPerLine = 1
ClientHeight = 29
ClientWidth = 539
ClientHeight = 25
ClientWidth = 527
TabOrder = 0
object btnInsertButton: TButton
Left = 0
Height = 29
Height = 25
Top = 0
Width = 130
Width = 119
AutoSize = True
Caption = '&Insert new button'
OnClick = btnInsertButtonClick
TabOrder = 0
end
object btnCloneButton: TButton
Left = 138
Height = 29
Left = 127
Height = 25
Top = 0
Width = 99
Width = 96
AutoSize = True
Caption = 'C&lone button'
OnClick = btnCloneButtonClick
TabOrder = 1
end
object btnDeleteButton: TButton
Left = 245
Height = 29
Left = 231
Height = 25
Top = 0
Width = 56
Width = 59
AutoSize = True
Caption = '&Delete'
OnClick = btnDeleteButtonClick
TabOrder = 2
end
object btnExport: TButton
Left = 309
Height = 29
Left = 298
Height = 25
Top = 0
Width = 70
Width = 68
AutoSize = True
Caption = 'Export...'
OnClick = btnExportClick
TabOrder = 3
end
object btnImport: TButton
Left = 387
Height = 29
Left = 374
Height = 25
Top = 0
Width = 71
AutoSize = True
@ -232,10 +233,10 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
TabOrder = 4
end
object btnBackup: TButton
Left = 466
Height = 29
Left = 453
Height = 25
Top = 0
Width = 73
Width = 74
AutoSize = True
Caption = 'Backup...'
OnClick = btnBackupClick
@ -250,14 +251,14 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 307
Top = 260
Height = 292
Top = 275
Width = 838
Anchors = [akLeft, akRight, akBottom]
AutoSize = True
BorderSpacing.Bottom = 6
BevelOuter = bvNone
ClientHeight = 307
ClientHeight = 292
ClientWidth = 838
TabOrder = 2
object rgToolItemType: TRadioGroup
@ -266,9 +267,9 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideBottom.Control = pnlEditToolbar
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 307
Height = 292
Top = 0
Width = 5
Width = 81
Anchors = [akTop, akLeft, akBottom]
AutoFill = True
AutoSize = True
@ -291,10 +292,10 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = pnlEditToolbar
AnchorSideBottom.Side = asrBottom
Left = 11
Height = 307
Left = 87
Height = 292
Top = 0
Width = 821
Width = 745
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 6
BorderSpacing.Right = 6
@ -303,14 +304,14 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
ChildSizing.VerticalSpacing = 10
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 307
ClientWidth = 821
ClientHeight = 292
ClientWidth = 745
TabOrder = 1
object lblIconFile: TLabel
Left = 0
Height = 17
Height = 15
Top = 6
Width = 83
Width = 62
Alignment = taRightJustify
Caption = 'Ico&n:'
FocusControl = edtIconFileName
@ -323,10 +324,10 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideTop.Control = lblIconFile
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = btnOpenIcon
Left = 85
Height = 27
Top = 1
Width = 672
Left = 64
Height = 23
Top = 2
Width = 617
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 2
MaxLength = 259
@ -339,9 +340,9 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideRight.Control = btnRelativeIconFileName
AnchorSideBottom.Control = edtIconFileName
AnchorSideBottom.Side = asrBottom
Left = 757
Height = 27
Top = 1
Left = 681
Height = 23
Top = 2
Width = 32
Anchors = [akTop, akRight, akBottom]
Caption = '>>'
@ -352,9 +353,9 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
object lblToolTip: TLabel
AnchorSideTop.Side = asrCenter
Left = 0
Height = 17
Top = 33
Width = 83
Height = 15
Top = 31
Width = 62
Alignment = taRightJustify
Caption = '&Tooltip:'
FocusControl = edtToolTip
@ -368,10 +369,10 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = pnlEditControls
AnchorSideRight.Side = asrBottom
Left = 85
Height = 27
Top = 28
Width = 736
Left = 64
Height = 23
Top = 27
Width = 681
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 2
MaxLength = 259
@ -381,9 +382,9 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
object lblInternalCommand: TLabel
AnchorSideTop.Side = asrCenter
Left = 0
Height = 17
Top = 60
Width = 83
Height = 15
Top = 56
Width = 62
Alignment = taRightJustify
Caption = 'Co&mmand:'
FocusControl = cbInternalCommand
@ -397,15 +398,15 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = pnlEditControls
AnchorSideRight.Side = asrBottom
Left = 85
Height = 31
Top = 53
Width = 736
Left = 64
Height = 23
Top = 52
Width = 681
HelpType = htKeyword
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 2
DropDownCount = 20
ItemHeight = 0
ItemHeight = 15
OnSelect = cbInternalCommandSelect
Style = csDropDownList
TabOrder = 3
@ -414,8 +415,8 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
object lblInternalParameters: TLabel
Left = 0
Height = 100
Top = 87
Width = 83
Top = 81
Width = 62
Alignment = taRightJustify
Caption = '&Parameters:'
Constraints.MinHeight = 100
@ -431,11 +432,11 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = lblInternalParameters
AnchorSideBottom.Side = asrBottom
Left = 85
Left = 64
Height = 100
Hint = 'Enter command parameters, each in a separate line. Press F1 to see help on parameters.'
Top = 87
Width = 736
Top = 81
Width = 681
HelpType = htKeyword
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 2
@ -449,9 +450,9 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
object lblExternalCommand: TLabel
AnchorSideTop.Side = asrCenter
Left = 0
Height = 17
Top = 197
Width = 83
Height = 15
Top = 191
Width = 62
Alignment = taRightJustify
Caption = 'Comman&d:'
FocusControl = edtExternalCommand
@ -464,10 +465,10 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideTop.Control = lblExternalCommand
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = btnOpenFile
Left = 85
Height = 27
Top = 192
Width = 672
Left = 64
Height = 23
Top = 187
Width = 617
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 2
MaxLength = 259
@ -479,9 +480,9 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideRight.Control = btnRelativeExternalCommand
AnchorSideBottom.Control = edtExternalCommand
AnchorSideBottom.Side = asrBottom
Left = 757
Height = 27
Top = 192
Left = 681
Height = 23
Top = 187
Width = 32
Anchors = [akTop, akRight, akBottom]
BorderSpacing.InnerBorder = 4
@ -493,9 +494,9 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
object lblExternalParameters: TLabel
AnchorSideTop.Side = asrCenter
Left = 0
Height = 17
Top = 224
Width = 83
Height = 15
Top = 216
Width = 62
Alignment = taRightJustify
Caption = 'Parameter&s:'
FocusControl = edtExternalParameters
@ -509,10 +510,10 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = pnlEditControls
AnchorSideRight.Side = asrBottom
Left = 85
Height = 27
Top = 219
Width = 736
Left = 64
Height = 23
Top = 212
Width = 681
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 2
MaxLength = 259
@ -522,9 +523,9 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
object lblStartPath: TLabel
AnchorSideTop.Side = asrCenter
Left = 0
Height = 17
Top = 251
Width = 83
Height = 15
Top = 241
Width = 62
Alignment = taRightJustify
Caption = 'Start pat&h:'
FocusControl = edtStartPath
@ -537,10 +538,10 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideTop.Control = lblStartPath
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = btnStartPath
Left = 85
Height = 27
Top = 246
Width = 672
Left = 64
Height = 23
Top = 237
Width = 617
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 2
MaxLength = 259
@ -550,9 +551,9 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
object lblHotkey: TLabel
AnchorSideTop.Side = asrCenter
Left = 0
Height = 17
Top = 278
Width = 83
Height = 15
Top = 266
Width = 62
Alignment = taRightJustify
Caption = 'Hot key:'
ParentColor = False
@ -562,9 +563,9 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideLeft.Control = lblHotkey
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = lblHotkey
Left = 85
Left = 64
Height = 1
Top = 278
Top = 266
Width = 1
BorderSpacing.Left = 2
BorderSpacing.Right = 10
@ -576,10 +577,10 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = lblHotkey
AnchorSideTop.Side = asrCenter
Left = 96
Height = 29
Top = 272
Width = 88
Left = 75
Height = 25
Top = 261
Width = 85
AutoSize = True
BorderSpacing.Left = 2
Caption = 'Edit hot&key'
@ -592,10 +593,10 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = lblHotkey
AnchorSideTop.Side = asrCenter
Left = 186
Height = 29
Top = 272
Width = 115
Left = 162
Height = 25
Top = 261
Width = 108
AutoSize = True
BorderSpacing.Left = 2
Caption = 'Remove hotke&y'
@ -609,9 +610,9 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = edtExternalCommand
AnchorSideBottom.Side = asrBottom
Left = 789
Height = 27
Top = 192
Left = 713
Height = 23
Top = 187
Width = 32
Anchors = [akTop, akRight, akBottom]
Glyph.Data = {
@ -659,9 +660,9 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = edtIconFileName
AnchorSideBottom.Side = asrBottom
Left = 789
Height = 27
Top = 1
Left = 713
Height = 23
Top = 2
Width = 32
Anchors = [akTop, akRight, akBottom]
Glyph.Data = {
@ -708,9 +709,9 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideRight.Control = btnRelativeStartPath
AnchorSideBottom.Control = edtStartPath
AnchorSideBottom.Side = asrBottom
Left = 757
Height = 27
Top = 246
Left = 681
Height = 23
Top = 237
Width = 32
Anchors = [akTop, akRight, akBottom]
BorderSpacing.InnerBorder = 4
@ -725,9 +726,9 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = edtStartPath
AnchorSideBottom.Side = asrBottom
Left = 789
Height = 27
Top = 246
Left = 713
Height = 23
Top = 237
Width = 32
Anchors = [akTop, akRight, akBottom]
Glyph.Data = {
@ -779,8 +780,8 @@ inherited frmOptionsToolbar: TfrmOptionsToolbar
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = pnlFullToolbarButtons
Left = 6
Height = 120
Top = 107
Height = 145
Top = 101
Width = 838
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2

View file

@ -201,6 +201,7 @@ type
procedure btnBackupClick(Sender: TObject);
procedure miExportToAnythingClick(Sender: TObject);
procedure miImportFromAnythingClick(Sender: TObject);
procedure GenericSomethingChanged(Sender: TObject);
private
FCurrentButton: TKASToolButton;
@ -210,6 +211,7 @@ type
FUpdatingButtonType: Boolean;
FUpdatingIconText: Boolean;
bFirstTimeDrawn: boolean;
FModificationTookPlace: boolean;
FLastLoadedToolbarsSignature: dword;
function AddNewSubToolbar(ToolItem: TKASMenuItem): TKASToolBar;
procedure ApplyEditControls;
@ -370,6 +372,7 @@ begin
gSpecialDirList.PopulateMenuWithSpecialDir(pmPathHelper,mp_PATHHELPER,nil);
FLastLoadedToolbarsSignature := ComputeToolbarsSignature;
FModificationTookPlace := False;
end;
procedure TfrmOptionsToolbar.LoadCurrentButton;
@ -554,6 +557,7 @@ begin
gConfig.ClearNode(ToolBarNode);
Toolbar.SaveConfiguration(gConfig, ToolBarNode);
FLastLoadedToolbarsSignature := ComputeToolbarsSignature;
FModificationTookPlace := False;
end;
Result := [];
@ -910,6 +914,7 @@ begin
ToolBar := pnToolbars.Controls[i] as TKASToolBar;
ToolBar.Flat := cbFlatButtons.Checked;
end;
GenericSomethingChanged(Sender);
end;
procedure TfrmOptionsToolbar.edtIconFileNameChange(Sender: TObject);
@ -971,6 +976,7 @@ begin
ToolBar := pnToolbars.Controls[i] as TKASToolBar;
ToolBar.SetButtonSize(trbBarSize.Position * 2, trbBarSize.Position * 2);
end;
GenericSomethingChanged(Sender);
finally
EnableAutoSizing;
end;
@ -989,6 +995,7 @@ begin
ToolBar := pnToolbars.Controls[i] as TKASToolBar;
ToolBar.GlyphSize := trbIconSize.Position * 2;
end;
GenericSomethingChanged(Sender);
finally
EnableAutoSizing;
end;
@ -1183,7 +1190,7 @@ function TfrmOptionsToolbar.CanWeClose(var WillNeedUpdateWindowView: boolean): b
var
Answer: TMyMsgResult;
begin
Result := (FLastLoadedToolbarsSignature = ComputeToolbarsSignature);
Result := (FLastLoadedToolbarsSignature = ComputeToolbarsSignature) AND (not FModificationTookPlace);
if not Result then
begin
@ -1301,17 +1308,11 @@ var
ToolBar: TKASToolBar;
InnerResult: boolean = False;
ActionDispatcher: integer;
FreezeTime: TDateTime;
MyYear, MyMonth, MyDay, MyHour, MyMin, MySec, MyMilSec: word;
begin
with Sender as TComponent do
ActionDispatcher := tag;
FreezeTime := now;
DecodeDate(Freezetime, MyYear, MyMonth, MyDay);
DecodeTime(FreezeTime, MyHour, MyMin, MySec, MyMilSec);
//1. Make we got an invalid name from the start
SaveDialog.Filename := '';
@ -1344,7 +1345,7 @@ begin
BackupPath := IncludeTrailingPathDelimiter(mbExpandFileName(EnvVarConfigPath)) + 'Backup';
if mbForceDirectory(BackupPath) then
begin
SaveDialog.Filename := BackupPath + DirectorySeparator + 'Backup_' + Format('%d-%2.2d-%2.2d@%2.2d-%2.2d-%2.2d', [MyYear, MyMonth, MyDay, MyHour, MyMin, MySec]) + '.toolbar';
SaveDialog.Filename := BackupPath + DirectorySeparator + 'Backup_' + GetDateTimeInStrEZSortable(now) + '.toolbar';
FlagKeepGoing := True;
end;
end;
@ -1579,4 +1580,11 @@ begin
end;
end;
{ TfrmOptionsToolbar.GenericSomethingChanged }
procedure TfrmOptionsToolbar.GenericSomethingChanged(Sender: TObject);
begin
FModificationTookPlace := True;
end;
end.

View file

@ -39,6 +39,11 @@ const
CFSTR_UNIFORM_RESOURCE_LOCATOR = 'UniformResourceLocator';
CFSTR_UNIFORM_RESOURCE_LOCATORW = 'UniformResourceLocatorW';
CFSTR_SHELL_IDLIST_ARRAY = 'Shell IDList Array';
CFSTR_FILEDESCRIPTOR = 'FileGroupDescriptor';
CFSTR_FILEDESCRIPTORW = 'FileGroupDescriptorW';
CFSTR_FILECONTENTS = 'FileContents';
CFSTR_HTMLFORMAT = 'HTML Format';
CFSTR_RICHTEXTFORMAT = 'Rich Text Format';
{$ELSE IFDEF UNIX}
@ -63,6 +68,11 @@ var
CFU_UNIFORM_RESOURCE_LOCATOR,
CFU_UNIFORM_RESOURCE_LOCATORW,
CFU_SHELL_IDLIST_ARRAY,
CFU_FILECONTENTS,
CFU_FILEGROUPDESCRIPTOR,
CFU_FILEGROUPDESCRIPTORW,
CFU_HTML,
CFU_RICHTEXT,
{$ELSE IFDEF UNIX}
@ -95,6 +105,11 @@ begin
CFU_UNIFORM_RESOURCE_LOCATOR := RegisterClipboardFormat(CFSTR_UNIFORM_RESOURCE_LOCATOR);
CFU_UNIFORM_RESOURCE_LOCATORW := RegisterClipboardFormat(CFSTR_UNIFORM_RESOURCE_LOCATORW);
CFU_SHELL_IDLIST_ARRAY := RegisterClipboardFormat(CFSTR_SHELL_IDLIST_ARRAY);
CFU_FILECONTENTS := $8000 OR RegisterClipboardFormat(CFSTR_FILECONTENTS) And $7FFF;
CFU_FILEGROUPDESCRIPTOR := $8000 OR RegisterClipboardFormat(CFSTR_FILEDESCRIPTOR) And $7FFF;
CFU_FILEGROUPDESCRIPTORW := $8000 OR RegisterClipboardFormat(CFSTR_FILEDESCRIPTORW) And $7FFF;
CFU_HTML := $8000 OR RegisterClipboardFormat(CFSTR_HTMLFORMAT) And $7FFF;
CFU_RICHTEXT := $8000 OR RegisterClipboardFormat(CFSTR_RICHTEXTFORMAT) And $7FFF;
{$ELSEIF DEFINED(UNIX)}

View file

@ -136,6 +136,11 @@ function GetAppConfigDir: String;
}
function GetAppCacheDir: UTF8String;
function GetTempFolder: String;
{ Similar to "GetTempFolder" but that we can unilaterally delete at the end when closin application}
function GetTempFolderDeletableAtTheEnd: String;
procedure DeleteTempFolderDeletableAtTheEnd;
{en
Get the system specific self extracting archive extension
@returns(Self extracting archive extension)
@ -190,7 +195,7 @@ function GetComputerNetName: UTF8String;
implementation
uses
FileUtil, uDCUtils, DCOSUtils, DCStrUtils, uGlobs, uLng
uFileProcs, FileUtil, uDCUtils, DCOSUtils, DCStrUtils, uGlobs, uLng
{$IF DEFINED(MSWINDOWS)}
, JwaWinCon, Windows, uNTFSLinks, uMyWindows, JwaWinNetWk, uShlObjAdditional
, shlobj
@ -762,6 +767,23 @@ begin
Result:= Result + PathDelim;
end;
function GetTempFolderDeletableAtTheEnd: String;
begin
Result:= GetTempDir + '_dc~~~';
if not mbDirectoryExists(Result) then
mbCreateDir(Result);
Result:= Result + PathDelim;
end;
procedure DeleteTempFolderDeletableAtTheEnd;
var
TempFolderName:string;
begin
TempFolderName:= GetTempDir + '_dc~~~';
if mbDirectoryExists(TempFolderName) then
DelTree(TempFolderName);
end;
function GetSfxExt: String;
{$IFDEF MSWINDOWS}
begin

File diff suppressed because it is too large Load diff

View file

@ -42,6 +42,7 @@ type
procedure RunListen;
procedure StopListen;
function isAnotherDCRunningWhileIamRunning:boolean;
property OnMessage: TOnUniqueInstanceMessage read FOnMessage write FOnMessage;
property ServernameByUser: String read FServernameByUser;
@ -71,7 +72,7 @@ uses
{$ELSEIF DEFINED(UNIX)}
ipc, baseunix,
{$ENDIF}
StrUtils, FileUtil, uGlobs, uDebug;
Forms, StrUtils, FileUtil, uGlobs, uDebug;
{$IF DEFINED(UNIX)}
type
@ -284,6 +285,41 @@ begin
{$ENDIF}
end;
function TUniqueInstance.isAnotherDCRunningWhileIamRunning:boolean;
var
LocalClientIPC: TSimpleIPCClient;
IndexInstance:integer;
function GetServerIdNameToCheck:string;
begin
result:=ApplicationName+'-';
if IndexInstance>1 then result:=result+IntToStr(IndexInstance);
{$IF DEFINED(UNIX)}
result := result + '-' + IntToStr(fpGetUID);
{$ENDIF}
end;
begin
Result:=True;
if IsRunning then
begin
FServerIPC.Active:=False;
try
LocalClientIPC:=TSimpleIPCClient.Create(nil);
IndexInstance:=1;
Result:=FALSE;
repeat
LocalClientIPC.ServerID:=GetServerIdNameToCheck;
Result:=LocalClientIPC.ServerRunning;
inc(IndexInstance);
until Result OR (IndexInstance>=10);
finally
FServerIPC.Active:=True;
end;
end;
end;
constructor TUniqueInstance.Create(aInstanceName: String; aServernameByUser: String);
begin
FServernameByUser := aServernameByUser;

View file

@ -1020,7 +1020,7 @@ procedure ExportDCToolbarsToTC(Toolbar: TKASToolbar; Barfilename: string; FlushE
var
TargetBarFilenamePrefix: string;
TCToolBarIndex: integer;
MyYear, MyMonth, MyDay, MyHour, MyMin, MySec, MyMilSec: word;
ExportationDateTime: TDateTime;
procedure PossiblyRecursiveAddThisToolItemToConfigFile(ToolItem: TKASToolItem; TCBarConfigFile: TIniFileEx; TCIndexButton: integer);
var
@ -1059,7 +1059,7 @@ var
if ToolItem is TKASMenuItem then
begin
InnerTCBarConfigFilename := TargetBarFilenamePrefix + '_SubBar' + Format('%2.2d', [TCToolBarIndex]) + '_' + Format('%d-%2.2d-%2.2d@%2.2d-%2.2d-%2.2d', [MyYear, MyMonth, MyDay, MyHour, MyMin, MySec]) + '.BAR';
InnerTCBarConfigFilename := TargetBarFilenamePrefix + '_SubBar' + Format('%2.2d', [TCToolBarIndex]) + '_' + GetDateTimeInStrEZSortable(ExportationDateTime) + '.BAR';
Inc(TCToolBarIndex);
TCBarConfigFile.WriteString(TCCONFIG_BUTTONBAR_SECTION, TCCONFIG_CMD_PREFIX + sTCIndexButton, ConvertStringToTCString(InnerTCBarConfigFilename));
@ -1087,12 +1087,9 @@ var
//Placed intentionnally *AFTER* above routine to make sure these variable names are not used in above possibly recursive routines.
TCMainConfigFile, MainTCBarConfigFile: TIniFileEx;
IndexButton, TCMainIndexButton: integer;
FreezeTime: TDateTime;
begin
FreezeTime := now;
DecodeDate(Freezetime, MyYear, MyMonth, MyDay);
DecodeTime(FreezeTime, MyHour, MyMin, MySec, MyMilSec);
ExportationDateTime := now;
TargetBarFilenamePrefix := IncludeTrailingPathDelimiter(gTotalCommanderToolbarPath) + rsFilenameExportedTCBarPrefix;
TCToolBarIndex := 1;

View file

@ -92,6 +92,7 @@ function ShowInputQuery(const ACaption, APrompt: UTF8String; var Value: UTF8Stri
function ShowInputQuery(Thread: TThread; const ACaption, APrompt: UTF8String; var Value: UTF8String): Boolean; overload;
function ShowInputComboBox(const sCaption, sPrompt : UTF8String; slValueList : TStringList; var sValue : UTF8String) : Boolean;
function ShowInputListBox(const sCaption, sPrompt : UTF8String; slValueList : TStringList; var sValue : UTF8String; var SelectedChoice:integer) : Boolean;
procedure msgLoadLng;
@ -527,6 +528,80 @@ begin
end; // with frmDialog
end;
function ShowInputListBox(const sCaption, sPrompt : UTF8String; slValueList : TStringList;
var sValue : UTF8String; var SelectedChoice:integer) : Boolean;
var
frmDialog : TForm;
lblPrompt : TLabel;
lbValue : TListBox;
bbtnOK,
bbtnCancel : TBitBtn;
begin
SelectedChoice:=-1;
frmDialog := TForm.CreateNew(nil, 0);
with frmDialog do
try
BorderStyle := bsDialog;
Position := poScreenCenter;
AutoSize := True;
Height := 120;
ChildSizing.TopBottomSpacing := 8;
ChildSizing.LeftRightSpacing := 8;
Caption := sCaption;
lblPrompt := TLabel.Create(frmDialog);
with lblPrompt do
begin
Parent := frmDialog;
Caption := sPrompt;
Top := 6;
Left := 6;
end;
lbValue := TListBox.Create(frmDialog);
with lbValue do
begin
Parent := frmDialog;
Items.Assign(slValueList);
ItemIndex:=Items.IndexOf(sValue);
if (ItemIndex=-1) AND (Items.count>0) then ItemIndex:=0;
Left := 6;
AnchorToNeighbour(akTop, 6, lblPrompt);
Constraints.MinWidth := max(280, Screen.Width div 4);
end;
bbtnCancel := TBitBtn.Create(frmDialog);
with bbtnCancel do
begin
Parent := frmDialog;
Kind := bkCancel;
Cancel := True;
Left := 6;
Width:= 90;
Anchors := [akTop, akRight];
AnchorToNeighbour(akTop, 18, lbValue);
AnchorSide[akRight].Control := lbValue;
AnchorSide[akRight].Side := asrRight;
end;
bbtnOK := TBitBtn.Create(frmDialog);
with bbtnOK do
begin
Parent := frmDialog;
Kind := bkOk;
Default := True;
Width:= 90;
Anchors := [akTop, akRight];
AnchorToNeighbour(akTop, 18, lbValue);
AnchorToNeighbour(akRight, 6, bbtnCancel);
end;
Result := (ShowModal = mrOK) AND (lbValue.ItemIndex<>-1);
if Result then
begin
sValue:=lbValue.Items.Strings[lbValue.ItemIndex];
SelectedChoice:=lbValue.ItemIndex
end;
finally
FreeAndNil(frmDialog);
end; // with frmDialog
end;
procedure msgLoadLng;
var
I: TMyMsgButton;

View file

@ -241,7 +241,7 @@ implementation
uses
LCLProc, LCLType, uMasks, FileUtil, StrUtils, uOSUtils, uGlobs, uGlobsPaths,
DCStrUtils, DCOSUtils, uSpecialDir;
DCStrUtils, DCOSUtils;
var
dtLastDateSubstitutionCheck:TDateTime=0;

View file

@ -249,14 +249,24 @@ function GetNextCopyName(FileName: UTF8String): UTF8String;
var
CopyNumber: Int64 = 1;
sFilePath,
sFileName: UTF8String;
sFileName, SuffixStr: UTF8String;
begin
sFilePath:= ExtractFilePath(FileName);
sFileName:= ExtractFileName(FileName);
SuffixStr:= '';
repeat
Result := sFilePath + Format(rsCopyNameTemplate, [CopyNumber, sFileName]);
case gTypeOfDuplicatedRename of
drLegacyWithCopy: Result := sFilePath + Format(rsCopyNameTemplate, [CopyNumber, sFileName]);
drLikeWindows7, drLikeTC: Result :=sFilePath + RemoveFileExt(sFileName) + SuffixStr + ExtractFileExt(sFileName);
end;
Inc(CopyNumber);
until not mbFileSystemEntryExists(Result);
case gTypeOfDuplicatedRename of
drLikeWindows7: SuffixStr:=' ('+IntToStr(CopyNumber)+')';
drLikeTC: SuffixStr:='('+IntToStr(CopyNumber)+')';
end;
until not mbFileSystemEntryExists(Result);
end;
end.

View file

@ -96,6 +96,13 @@ type
TKeyTypingModifier = (ktmNone, ktmAlt, ktmCtrlAlt);
TKeyTypingAction = (ktaNone, ktaCommandLine, ktaQuickSearch, ktaQuickFilter);
tDesiredDropTextFormat=record
Name:string;
DesireLevel:longint;
end;
tDuplicatedRename = (drLegacyWithCopy, drLikeWindows7, drLikeTC);
const
{ Default hotkey list version number }
hkVersion = 20;
@ -117,6 +124,13 @@ const
TKeyTypingModifierToShift: array[TKeyTypingModifier] of TShiftState =
([], [ssAlt], [ssCtrl, ssAlt]);
{ Related with the drop of text over panels}
NbOfDropTextFormat = 4;
DropTextRichText_Index=0;
DropTextHtml_Index=1;
DropTextUnicode_Index=2;
DropTextSimpleText_Index=3;
var
{ For localization }
gPOFileName,
@ -268,6 +282,7 @@ var
gUseMmapInSearch : Boolean;
gPartialNameSearch: Boolean;
gSkipFileOpError: Boolean;
gTypeOfDuplicatedRename: tDuplicatedRename;
gDropReadOnlyFlag : Boolean;
gWipePassNumber: Integer;
gProcessComments: Boolean;
@ -275,6 +290,10 @@ var
gUseTrash : Boolean; // if using delete to trash by default
gRenameSelOnlyName:boolean;
gShowDialogOnDragDrop: Boolean;
gDragAndDropDesiredTextFormat:array[0..pred(NbOfDropTextFormat)] of tDesiredDropTextFormat;
gDragAndDropAskFormatEachTime: Boolean;
gDragAndDropTextAutoFilename: Boolean;
gDragAndDropSaveUnicodeTextInUFT8: Boolean;
gOverwriteFolder: Boolean;
gNtfsHourTimeDelay: Boolean;
gFileOperationsProgressKind: TFileOperationsProgressKind;
@ -1145,7 +1164,19 @@ begin
gShowCopyTabSelectPanel := False;
gUseTrash := True;
gSkipFileOpError := False;
gTypeOfDuplicatedRename := drLegacyWithCopy;
gShowDialogOnDragDrop := False;
gDragAndDropDesiredTextFormat[DropTextRichText_Index].Name:='Richtext format';
gDragAndDropDesiredTextFormat[DropTextRichText_Index].DesireLevel:=0;
gDragAndDropDesiredTextFormat[DropTextHtml_Index].Name:='HTML format';
gDragAndDropDesiredTextFormat[DropTextHtml_Index].DesireLevel:=1;
gDragAndDropDesiredTextFormat[DropTextUnicode_Index].Name:='Unicode format';
gDragAndDropDesiredTextFormat[DropTextUnicode_Index].DesireLevel:=2;
gDragAndDropDesiredTextFormat[DropTextSimpleText_Index].Name:='Simple text format';
gDragAndDropDesiredTextFormat[DropTextSimpleText_Index].DesireLevel:=3;
gDragAndDropAskFormatEachTime := False;
gDragAndDropTextAutoFilename := False;
gDragAndDropSaveUnicodeTextInUFT8 := True;
gOverwriteFolder := False;
gNtfsHourTimeDelay := False;
gFileOperationsProgressKind := fopkSeparateWindow;
@ -2199,7 +2230,15 @@ begin
gShowCopyTabSelectPanel := GetValue(Node, 'ShowCopyTabSelectPanel', gShowCopyTabSelectPanel);
gUseTrash := GetValue(Node, 'UseTrash', gUseTrash);
gSkipFileOpError := GetValue(Node, 'SkipFileOpError', gSkipFileOpError);
gTypeOfDuplicatedRename := tDuplicatedRename(GetValue(Node, 'TypeOfDuplicatedRename', Integer(gTypeOfDuplicatedRename)));
gShowDialogOnDragDrop := GetValue(Node, 'ShowDialogOnDragDrop', gShowDialogOnDragDrop);
gDragAndDropDesiredTextFormat[DropTextRichText_Index].DesireLevel := GetValue(Node, 'DragAndDropTextRichtextDesireLevel', gDragAndDropDesiredTextFormat[DropTextRichText_Index].DesireLevel);
gDragAndDropDesiredTextFormat[DropTextHtml_Index].DesireLevel := GetValue(Node, 'DragAndDropTextHtmlDesireLevel',gDragAndDropDesiredTextFormat[DropTextHtml_Index].DesireLevel);
gDragAndDropDesiredTextFormat[DropTextUnicode_Index].DesireLevel := GetValue(Node, 'DragAndDropTextUnicodeDesireLevel',gDragAndDropDesiredTextFormat[DropTextUnicode_Index].DesireLevel);
gDragAndDropDesiredTextFormat[DropTextSimpleText_Index].DesireLevel := GetValue(Node, 'DragAndDropTextSimpletextDesireLevel',gDragAndDropDesiredTextFormat[DropTextSimpleText_Index].DesireLevel);
gDragAndDropAskFormatEachTime := GetValue(Node,'DragAndDropAskFormatEachTime', gDragAndDropAskFormatEachTime);
gDragAndDropTextAutoFilename := GetValue(Node, 'DragAndDropTextAutoFilename', gDragAndDropTextAutoFilename);
gDragAndDropSaveUnicodeTextInUFT8 := GetValue(Node, 'DragAndDropSaveUnicodeTextInUFT8', gDragAndDropSaveUnicodeTextInUFT8);
gOverwriteFolder := GetValue(Node, 'OverwriteFolder', gOverwriteFolder);
gNtfsHourTimeDelay := GetValue(Node, 'NtfsHourTimeDelay', gNtfsHourTimeDelay);
gFileOperationsProgressKind := TFileOperationsProgressKind(GetValue(Node, 'ProgressKind', Integer(gFileOperationsProgressKind)));
@ -2585,7 +2624,15 @@ begin
SetValue(Node, 'ShowCopyTabSelectPanel', gShowCopyTabSelectPanel);
SetValue(Node, 'UseTrash', gUseTrash);
SetValue(Node, 'SkipFileOpError', gSkipFileOpError);
SetValue(Node, 'TypeOfDuplicatedRename', Integer(gTypeOfDuplicatedRename));
SetValue(Node, 'ShowDialogOnDragDrop', gShowDialogOnDragDrop);
SetValue(Node, 'DragAndDropTextRichtextDesireLevel', gDragAndDropDesiredTextFormat[DropTextRichText_Index].DesireLevel);
SetValue(Node, 'DragAndDropTextHtmlDesireLevel',gDragAndDropDesiredTextFormat[DropTextHtml_Index].DesireLevel);
SetValue(Node, 'DragAndDropTextUnicodeDesireLevel',gDragAndDropDesiredTextFormat[DropTextUnicode_Index].DesireLevel);
SetValue(Node, 'DragAndDropTextSimpletextDesireLevel',gDragAndDropDesiredTextFormat[DropTextSimpleText_Index].DesireLevel);
SetValue(Node, 'DragAndDropAskFormatEachTime', gDragAndDropAskFormatEachTime);
SetValue(Node, 'DragAndDropTextAutoFilename', gDragAndDropTextAutoFilename);
SetValue(Node, 'DragAndDropSaveUnicodeTextInUFT8', gDragAndDropSaveUnicodeTextInUFT8);
SetValue(Node, 'OverwriteFolder', gOverwriteFolder);
SetValue(Node, 'NtfsHourTimeDelay', gNtfsHourTimeDelay);
SetValue(Node, 'ProgressKind', Integer(gFileOperationsProgressKind));

View file

@ -130,6 +130,19 @@ resourcestring
rsMsgErrorInContextMenuCommand = 'Error in context menu command';
rsMsgErrorLoadingConfiguration = 'Error when loading configuration';
rsMsgInvalidFormatOfConfigurationFile = 'Invalid format of configuration file';
rsDefaultSuffixDroppedText = '_DroppedText';
rsDefaultSuffixDroppedTextRichtextFilename = '_DroppedRichtext';
rsDefaultSuffixDroppedTextHTMLFilename = '_DroppedHTMLtext';
rsDefaultSuffixDroppedTextUnicodeUTF16Filename = '_DroppedUnicodeUTF16text';
rsDefaultSuffixDroppedTextUnicodeUTF8Filename = '_DroppedUnicodeUTF8text';
rsDefaultSuffixDroppedTextSimpleFilename = '_DroppedSimpleText';
rsCaptionForAskingFilename = 'Enter filename, with extension, for dropped text';
rsMsgPromptAskingFilename = 'Filename for dropped text:';
rsCaptionForTextFormatToImport = 'Text format to import';
rsMsgForTextFormatToImport = 'Select the text format to import';
rsMsgDragAndDropModifiedWantToSave = 'Options regarding mouse drag && drop have been modified. Do you want to save before to exit?';
rsMsgFileOperationsModifiedWantToSave = 'Options regarding file operations have been modified. Do you want to save before to exit?';
rsMsgMiscellaneousModifiedWantToSave = 'Miscellaneous options have been modified. Do you want to save before to exit?';
//Hot Dir related
rsMsgHotDirWhatToDelete = 'Do you want to delete all elements inside the sub-menu [%s]?'+#$0A+'Answering NO will delete only menu delimiters but will keep element inside sub-menu.';