Converter: improve the GUI for commenting / skipping missing units.

git-svn-id: trunk@42459 -
This commit is contained in:
juha 2013-08-23 11:47:16 +00:00
parent d80f88d719
commit 0d842e4c25
3 changed files with 186 additions and 129 deletions

View File

@ -726,7 +726,7 @@ begin
Result:=AskMissingUnits(MainUsedUnits.MissingUnits, ImplUsedUnits.MissingUnits,
ExtractFileName(fLazUnitFilename), fOwnerConverter.fSettings.SupportDelphi);
case Result of
// mrOK means: comment out.
// mrOK means: Comment out.
mrOK: begin
if fOwnerConverter is TConvertDelphiProjPack then
MoveMissingToComment(fOwnerConverter.fAllCommentedUnits)
@ -756,14 +756,13 @@ begin
end;
Result:=mrOK; // Caller will check for Result<>mrOK
end;
// Skip this unit.
mrIgnore: Exit;
// mrIgnore means: Skip this unit. The missing units list is already cleared.
mrIgnore:
Result:=mrOK;
// Abort the whole conversion.
mrAbort: begin
mrAbort:
fOwnerConverter.fErrorMsg:='User selected to end conversion with file '
+fOrigUnitFilename;
Exit;
end;
end;
until not TryAgain;
end;

View File

@ -1,123 +1,173 @@
object MissingUnitsDialog: TMissingUnitsDialog
Left = 280
Height = 323
Top = 149
Width = 711
Height = 261
Top = 211
Width = 732
HorzScrollBar.Page = 411
VertScrollBar.Page = 342
Caption = 'Units not Found'
ClientHeight = 323
ClientWidth = 711
ClientHeight = 261
ClientWidth = 732
Position = poScreenCenter
LCLVersion = '1.1'
object MissingUnitsInfoLabel: TLabel
Left = 16
Height = 15
Top = 16
Width = 90
Caption = 'Missing Units Info'
ParentColor = False
end
object CommentButton: TBitBtn
Left = 16
Height = 30
Top = 274
Width = 152
Anchors = [akLeft, akBottom]
Caption = 'Comment'
Default = True
ModalResult = 1
object ButtonPanel: TPanel
Left = 0
Height = 35
Top = 226
Width = 732
Align = alBottom
AutoSize = True
ClientHeight = 35
ClientWidth = 732
TabOrder = 0
object CommentButton: TBitBtn
AnchorSideLeft.Control = ButtonPanel
AnchorSideTop.Control = AbortButton
AnchorSideTop.Side = asrCenter
Left = 12
Height = 26
Top = 4
Width = 73
AutoSize = True
BorderSpacing.Left = 11
Caption = 'Comment'
Default = True
ModalResult = 1
TabOrder = 0
end
object SearchButton: TBitBtn
AnchorSideLeft.Control = CommentButton
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = CommentButton
AnchorSideTop.Side = asrCenter
Left = 96
Height = 26
Top = 4
Width = 58
AutoSize = True
BorderSpacing.Left = 11
Caption = 'Search'
ModalResult = 6
TabOrder = 1
end
object SkipButton: TBitBtn
AnchorSideLeft.Control = SearchButton
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = SearchButton
AnchorSideTop.Side = asrCenter
Left = 165
Height = 26
Top = 4
Width = 40
AutoSize = True
BorderSpacing.Left = 11
Caption = 'Skip'
ModalResult = 5
TabOrder = 2
end
object AbortButton: TBitBtn
AnchorSideRight.Control = ButtonPanel
AnchorSideRight.Side = asrBottom
Left = 638
Height = 33
Top = 1
Width = 82
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Right = 11
DefaultCaption = True
Kind = bkAbort
ModalResult = 3
TabOrder = 3
end
end
object SearchButton: TBitBtn
Left = 191
Height = 30
Top = 274
Width = 152
Anchors = [akBottom]
Caption = 'Search'
ModalResult = 6
object MissingUnitsGroupBox: TGroupBox
Left = 0
Height = 223
Top = 0
Width = 233
Align = alLeft
BorderSpacing.Bottom = 3
Caption = 'Missing Units Info'
ClientHeight = 204
ClientWidth = 229
TabOrder = 1
object MissingUnitsCheckListBox: TCheckListBox
Left = 0
Height = 204
Top = 0
Width = 229
Align = alClient
ItemHeight = 0
PopupMenu = PopupMenu1
TabOrder = 0
end
end
object AbortButton: TBitBtn
Left = 548
Height = 30
Top = 274
Width = 152
Anchors = [akRight, akBottom]
DefaultCaption = True
Kind = bkAbort
ModalResult = 3
TabOrder = 2
object Splitter1: TSplitter
Left = 233
Height = 226
Top = 0
Width = 5
end
object ChoicesLabel: TLabel
AnchorSideLeft.Control = MissingUnitsCheckListBox
AnchorSideLeft.Side = asrBottom
Left = 336
Height = 15
Top = 40
Width = 42
BorderSpacing.Left = 16
BorderSpacing.Top = 23
Caption = 'Choices:'
ParentColor = False
end
object Info1Label: TLabel
AnchorSideLeft.Control = ChoicesLabel
AnchorSideTop.Control = ChoicesLabel
Left = 336
Height = 15
Top = 63
Width = 26
BorderSpacing.Top = 23
Caption = 'Info1'
ParentColor = False
end
object Info2Label: TLabel
AnchorSideLeft.Control = ChoicesLabel
AnchorSideTop.Control = Info1Label
Left = 336
Height = 15
Top = 86
Width = 26
BorderSpacing.Top = 23
Caption = 'Info2'
ParentColor = False
end
object Info3Label: TLabel
AnchorSideLeft.Control = ChoicesLabel
AnchorSideTop.Control = Info2Label
Left = 336
Height = 15
Top = 109
Width = 26
BorderSpacing.Top = 23
Caption = 'Info3'
ParentColor = False
end
object MissingUnitsCheckListBox: TCheckListBox
Left = 16
Height = 222
Top = 40
Width = 304
Anchors = [akTop, akLeft, akRight, akBottom]
ItemHeight = 0
PopupMenu = PopupMenu1
object InfoPanel: TPanel
Left = 238
Height = 217
Top = 9
Width = 494
Align = alClient
BorderSpacing.Top = 9
BevelOuter = bvNone
ClientHeight = 217
ClientWidth = 494
TabOrder = 3
end
object SkipButton: TBitBtn
Left = 373
Height = 30
Top = 274
Width = 152
Anchors = [akBottom]
Caption = 'Skip'
ModalResult = 5
TabOrder = 4
object ChoicesLabel: TLabel
AnchorSideLeft.Side = asrBottom
Left = 8
Height = 15
Top = 16
Width = 53
BorderSpacing.Left = 16
BorderSpacing.Top = 23
Caption = 'Choices:'
ParentColor = False
end
object Info1Label: TLabel
AnchorSideLeft.Control = ChoicesLabel
AnchorSideTop.Control = ChoicesLabel
Left = 8
Height = 15
Top = 39
Width = 31
BorderSpacing.Top = 23
Caption = 'Info1'
ParentColor = False
end
object Info2Label: TLabel
AnchorSideLeft.Control = ChoicesLabel
AnchorSideTop.Control = Info1Label
Left = 8
Height = 15
Top = 62
Width = 31
BorderSpacing.Top = 23
Caption = 'Info2'
ParentColor = False
end
object Info3Label: TLabel
AnchorSideLeft.Control = ChoicesLabel
AnchorSideTop.Control = Info2Label
Left = 8
Height = 15
Top = 85
Width = 31
BorderSpacing.Top = 23
Caption = 'Info3'
ParentColor = False
end
end
object PopupMenu1: TPopupMenu
left = 240
top = 200
left = 336
top = 48
object SelectMenuItem: TMenuItem
Caption = '&Select all'
OnClick = SelectMenuItemClick
@ -132,7 +182,7 @@ object MissingUnitsDialog: TMissingUnitsDialog
end
end
object SaveDialog1: TSaveDialog
left = 320
top = 200
left = 424
top = 48
end
end

View File

@ -33,7 +33,7 @@ interface
uses
// FCL+LCL
Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics,
Dialogs, Buttons, StdCtrls, FileUtil, CheckLst, Menus,
Dialogs, Buttons, StdCtrls, FileUtil, CheckLst, Menus, ExtCtrls,
// Components
SynEdit, CodeAtom, CodeCache, CodeToolManager, DefineTemplates,
// IDEIntf
@ -47,21 +47,24 @@ type
{ TMissingUnitsDialog }
TMissingUnitsDialog = class(TForm)
AbortButton: TBitBtn;
ChoicesLabel: TLabel;
CommentButton: TBitBtn;
ButtonPanel: TPanel;
Info1Label: TLabel;
Info2Label: TLabel;
Info3Label: TLabel;
MissingUnitsCheckListBox: TCheckListBox;
MissingUnitsGroupBox: TGroupBox;
InfoPanel: TPanel;
SearchButton: TBitBtn;
SkipButton: TBitBtn;
Splitter1: TSplitter;
UnselectMenuItem: TMenuItem;
SelectMenuItem: TMenuItem;
SaveDialog1: TSaveDialog;
SaveMenuItem: TMenuItem;
MissingUnitsCheckListBox: TCheckListBox;
CommentButton: TBitBtn;
ChoicesLabel: TLabel;
Info1Label: TLabel;
Info2Label: TLabel;
Info3Label: TLabel;
PopupMenu1: TPopupMenu;
SearchButton: TBitBtn;
AbortButton: TBitBtn;
MissingUnitsInfoLabel: TLabel;
procedure SaveMenuItemClick(Sender: TObject);
procedure SelectMenuItemClick(Sender: TObject);
procedure UnselectMenuItemClick(Sender: TObject);
@ -126,10 +129,13 @@ begin
UNFDialog:=TMissingUnitsDialog.Create(nil);
with UNFDialog do begin
Caption:=UnitsTitle;
SearchButton.Caption:=lisMissingUnitsSearch;
SkipButton.Caption:=lisMissingUnitsSkip;
MissingUnitsInfoLabel.Caption:=lisTheseUnitsWereNotFound;
MissingUnitsGroupBox.Caption:=lisTheseUnitsWereNotFound;
ChoicesLabel.Caption:=lisMissingUnitsChoices;
SearchButton.Caption:=lisMissingUnitsSearch;
SearchButton.LoadGlyphFromLazarusResource('menu_search_find');
SkipButton.Caption:=lisMissingUnitsSkip;
SkipButton.LoadGlyphFromLazarusResource('debugger_current_line_breakpoint');
CommentButton.LoadGlyphFromLazarusResource('menu_comment'); // or insertremark
if ATargetDelphi then begin
CommentButton.Caption:=lisMissingUnitsForDelphi;
Info1Label.Caption:=lisMissingUnitsInfo1b;
@ -143,13 +149,15 @@ begin
// Add missing units to CheckListBox.
AddUnitsToListBox(AMainMissingUnits);
AddUnitsToListBox(AImplMissingUnits);
// Show dialog and delete the entries that user has unchecked.
// Show dialog and remove the entries that user has unchecked.
// Missing units will be searched again later.
Result:=ShowModal;
if Result=mrOK then begin
if Result in [mrOK, mrIgnore] then begin // mrIgnore means "skip"
for i:=0 to MissingUnitsCheckListBox.Count-1 do begin
if not MissingUnitsCheckListBox.Checked[i] then begin
// Remove all when Skip was clicked.
if (Result=mrIgnore) or not MissingUnitsCheckListBox.Checked[i] then begin
s:=MissingUnitsCheckListBox.Items[i];
// Remove either from main or implementation sections list.
if not RemoveFromMissing(s, AMainMissingUnits) then begin
ImplRemoved:=RemoveFromMissing(s, AImplMissingUnits);
Assert(ImplRemoved, 'Error with Missing Units in AskMissingUnits.');