View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0029252 | Lazarus | IDE | public | 2015-12-25 16:57 | 2015-12-27 19:41 |
Reporter | Janusz Tomczak | Assigned To | Ondrej Pokorny | ||
Priority | normal | Severity | minor | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
Product Version | Product Build | ||||
Target Version | Fixed in Version | 1.7 (SVN) | |||
Summary | 0029252: [IdeIntf] ImageList Editor - new button "Replace" and other small changes | ||||
Description | When image list is large, it is very frustrating replace image (added at the end of the list and move up), so I implemented new button "Replace" and: - added confirmation dialog to option "Clear" - fixed anchors of button "Save All" | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 51054 | ||||
LazTarget | 1.8 | ||||
Widgetset | |||||
Attached Files |
|
|
ideintf.patch (12,388 bytes)
Index: imagelisteditor.lfm =================================================================== --- imagelisteditor.lfm (revision 51031) +++ imagelisteditor.lfm (working copy) @@ -1,7 +1,7 @@ object ImageListEditorDlg: TImageListEditorDlg - Left = 302 + Left = 453 Height = 379 - Top = 191 + Top = 144 Width = 616 BorderIcons = [biSystemMenu, biHelp] Caption = 'ImagesList Editor' @@ -12,7 +12,7 @@ OnCreate = FormCreate OnDestroy = FormDestroy Position = poScreenCenter - LCLVersion = '1.1' + LCLVersion = '1.7' object GroupBoxR: TGroupBox AnchorSideTop.Control = Owner AnchorSideRight.Control = Owner @@ -19,20 +19,20 @@ AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = BtnPanel Left = 376 - Height = 328 + Height = 335 Top = 6 Width = 234 Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Around = 6 Caption = 'Selected Image' - ClientHeight = 310 + ClientHeight = 315 ClientWidth = 230 TabOrder = 1 object LabelTransparent: TLabel Left = 110 Height = 15 - Top = 203 - Width = 92 + Top = 208 + Width = 98 Anchors = [akLeft, akBottom] BorderSpacing.Around = 6 Caption = 'Transparent Color:' @@ -47,11 +47,11 @@ end object Preview: TScrollBox Left = 6 - Height = 162 + Height = 167 Top = 32 Width = 217 - HorzScrollBar.Page = 213 - VertScrollBar.Page = 158 + HorzScrollBar.Page = 1 + VertScrollBar.Page = 1 Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Around = 6 Color = clGrayText @@ -62,7 +62,7 @@ object RadioGroup: TRadioGroup Left = 7 Height = 105 - Top = 200 + Top = 205 Width = 96 Anchors = [akLeft, akBottom] AutoFill = True @@ -76,7 +76,7 @@ ChildSizing.ShrinkVertical = crsScaleChilds ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.ControlsPerLine = 1 - ClientHeight = 87 + ClientHeight = 85 ClientWidth = 92 Enabled = False ItemIndex = 0 @@ -93,8 +93,8 @@ AnchorSideTop.Control = LabelTransparent AnchorSideTop.Side = asrBottom Left = 110 - Height = 24 - Top = 224 + Height = 22 + Top = 229 Width = 96 Selected = clFuchsia Style = [cbStandardColors, cbExtendedColors, cbIncludeDefault, cbCustomColor, cbPrettyNames] @@ -109,13 +109,13 @@ AnchorSideTop.Control = Owner AnchorSideBottom.Control = BtnPanel Left = 6 - Height = 328 + Height = 335 Top = 6 Width = 364 Anchors = [akTop, akLeft, akBottom] BorderSpacing.Around = 6 Caption = 'Images' - ClientHeight = 310 + ClientHeight = 315 ClientWidth = 360 TabOrder = 0 object TreeView: TTreeView @@ -122,12 +122,12 @@ AnchorSideLeft.Control = GroupBoxL AnchorSideTop.Control = GroupBoxL Left = 6 - Height = 299 + Height = 304 Top = 6 Width = 186 Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Around = 6 - DefaultItemHeight = 16 + DefaultItemHeight = 18 HideSelection = False Images = ImageList ReadOnly = True @@ -166,30 +166,30 @@ AnchorSideRight.Side = asrBottom Left = 198 Height = 25 - Top = 68 + Top = 99 Width = 156 Anchors = [akTop, akLeft, akRight] BorderSpacing.Around = 6 Caption = 'Clear' OnClick = BtnClearClick - TabOrder = 3 + TabOrder = 4 end object BtnDelete: TButton AnchorSideLeft.Control = TreeView AnchorSideLeft.Side = asrBottom - AnchorSideTop.Control = BtnAdd + AnchorSideTop.Control = BtnReplace AnchorSideTop.Side = asrBottom AnchorSideRight.Control = GroupBoxL AnchorSideRight.Side = asrBottom Left = 198 Height = 25 - Top = 37 + Top = 68 Width = 156 Anchors = [akTop, akLeft, akRight] BorderSpacing.Around = 6 Caption = '&Delete' OnClick = BtnDeleteClick - TabOrder = 2 + TabOrder = 3 end object BtnMoveUp: TButton Tag = -1 @@ -201,13 +201,13 @@ AnchorSideRight.Side = asrBottom Left = 198 Height = 25 - Top = 99 + Top = 130 Width = 156 Anchors = [akTop, akLeft, akRight] BorderSpacing.Around = 6 Caption = 'Move Up' OnClick = BtnMoveUpClick - TabOrder = 4 + TabOrder = 5 end object BtnMoveDown: TButton Tag = 1 @@ -219,13 +219,13 @@ AnchorSideRight.Side = asrBottom Left = 198 Height = 25 - Top = 130 + Top = 161 Width = 156 Anchors = [akTop, akLeft, akRight] BorderSpacing.Around = 6 Caption = 'Move Down' OnClick = BtnMoveUpClick - TabOrder = 5 + TabOrder = 6 end object BtnSave: TButton AnchorSideLeft.Control = TreeView @@ -236,34 +236,53 @@ AnchorSideRight.Side = asrBottom Left = 198 Height = 25 - Top = 161 + Top = 192 Width = 156 Anchors = [akTop, akLeft, akRight] BorderSpacing.Around = 6 Caption = 'Save...' OnClick = BtnSaveClick - TabOrder = 6 + TabOrder = 7 end object btnSaveAll: TButton AnchorSideLeft.Control = TreeView AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = BtnSave + AnchorSideTop.Side = asrBottom AnchorSideRight.Control = GroupBoxL AnchorSideRight.Side = asrBottom Left = 198 Height = 25 - Top = 194 + Top = 223 Width = 156 Anchors = [akTop, akLeft, akRight] BorderSpacing.Around = 6 Caption = 'Save All...' OnClick = btnSaveAllClick - TabOrder = 7 + TabOrder = 8 end + object BtnReplace: TButton + AnchorSideLeft.Control = TreeView + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = BtnAdd + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = GroupBoxL + AnchorSideRight.Side = asrBottom + Left = 198 + Height = 25 + Top = 37 + Width = 156 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Around = 6 + Caption = '&Replace...' + OnClick = BtnReplaceClick + TabOrder = 2 + end end object BtnPanel: TButtonPanel Left = 6 - Height = 33 - Top = 340 + Height = 26 + Top = 347 Width = 604 OKButton.Name = 'OKButton' OKButton.DefaultCaption = True Index: imagelisteditor.pp =================================================================== --- imagelisteditor.pp (revision 51031) +++ imagelisteditor.pp (working copy) @@ -47,6 +47,7 @@ BtnAdd: TButton; BtnClear: TButton; BtnDelete: TButton; + BtnReplace: TButton; BtnMoveUp: TButton; BtnMoveDown: TButton; BtnSave: TButton; @@ -66,6 +67,7 @@ procedure BtnAddClick(Sender: TObject); procedure BtnClearClick(Sender: TObject); procedure BtnDeleteClick(Sender: TObject); + procedure BtnReplaceClick(Sender: TObject); procedure BtnMoveUpClick(Sender: TObject); procedure btnSaveAllClick(Sender: TObject); procedure BtnSaveClick(Sender: TObject); @@ -85,7 +87,7 @@ procedure LoadFromImageList(AImageList: TImageList); procedure SaveToImageList; - procedure AddImageToList(const FileName: String); + procedure AddImageToList(const FileName: String; Insert : Boolean); end; //Editor call by Lazarus with 1 verbe only @@ -192,6 +194,7 @@ BtnAdd.Caption := sccsILEdtAdd; BtnDelete.Caption := sccsILEdtDelete; + BtnReplace.Caption := sccsILEdtReplace; BtnClear.Caption := sccsILEdtClear; BtnMoveUp.Caption := sccsILEdtMoveUp; BtnMoveDown.Caption := sccsILEdtMoveDown; @@ -229,6 +232,8 @@ var I: Integer; begin + OpenDialog.Title := sccsILEdtOpenDialog; + OpenDialog.Options:=OpenDialog.Options+[ofAllowMultiSelect]; if OpenDialog.Execute then begin ImageList.BeginUpdate; @@ -235,7 +240,7 @@ TreeView.BeginUpdate; try for I := 0 to OpenDialog.Files.Count - 1 do - AddImageToList(TrimRight(OpenDialog.Files[I])); + AddImageToList(TrimRight(OpenDialog.Files[I]),False); finally TreeView.EndUpdate; ImageList.EndUpdate; @@ -246,8 +251,14 @@ procedure TImageListEditorDlg.BtnClearClick(Sender: TObject); begin - ImageList.Clear; - TreeView.Items.Clear; + if TreeView.Items.Count=0 then exit; + if (IDEQuestionDialog(Caption, + s_Confirm_Clear, mtConfirmation, + [mrYes, mrNo]) = mrYes) then + begin + ImageList.Clear; + TreeView.Items.Clear; + end; end; procedure TImageListEditorDlg.BtnDeleteClick(Sender: TObject); @@ -280,6 +291,41 @@ TreeView.SetFocus; end; +procedure TImageListEditorDlg.BtnReplaceClick(Sender: TObject); +var + S,N: Integer; Node: TTreeNode; +begin + if Assigned(TreeView.Selected) then + begin + Node := TreeView.Selected; + OpenDialog.Title := sccsILEdtOpenDialogN; + OpenDialog.Options:=OpenDialog.Options-[ofAllowMultiSelect]; + if OpenDialog.Execute then + begin + ImageList.BeginUpdate; + TreeView.BeginUpdate; + try + AddImageToList(TrimRight(OpenDialog.FileName),True); + S:=TreeView.Selected.ImageIndex-1; + ImageList.Delete(S); + TreeView.Selected.ImageIndex:=S+1; + TreeView.Selected.Delete; + for N := S to TreeView.Items.Count-1 do + begin + TreeView.Items[N].Text := IntToStr(N); + TreeView.Items[N].ImageIndex := N; + TreeView.Items[N].SelectedIndex := N; + end; + TreeView.Selected:=Node; + finally + TreeView.EndUpdate; + ImageList.EndUpdate; + end; + TreeView.SetFocus; + end; + end; +end; + procedure TImageListEditorDlg.BtnMoveUpClick(Sender: TObject); var S, D: Integer; @@ -514,7 +560,7 @@ FModified := True; end; -procedure TImageListEditorDlg.AddImageToList(const FileName: String); +procedure TImageListEditorDlg.AddImageToList(const FileName: String;Insert:boolean); var SrcBmp: TBitmap; Picture: TPicture; @@ -557,7 +603,7 @@ end; //Ask the user if wants to split the source image if ((ImagesPerRow > 1) or (ImagesPerColumn > 1)) - and (IDEQuestionDialog(Caption +' - '+ btnAdd.Caption, + and (IDEQuestionDialog(Caption, s_SuggestSplitImage, mtConfirmation, [mrNo, s_AddAsSingle, mrYes, s_SplitImage]) <> mrYes) then begin @@ -576,8 +622,16 @@ P^.Adjustment := gaNone; P^.TransparentColor := clDefault; - I := ImageList.Add(P^.Bitmap, nil); - Node := TreeView.Items.AddObject(nil, IntToStr(I), P); + if Insert then + begin + I := TreeView.Selected.ImageIndex+1; + ImageList.Insert(I,P^.Bitmap, nil); + Node := TreeView.Items.InsertObjectBehind(TreeView.Selected, IntToStr(I), P); + end else + begin + I := ImageList.Add(P^.Bitmap, nil); + Node := TreeView.Items.AddObject(nil, IntToStr(I), P); + end; Node.ImageIndex := I; Node.SelectedIndex := I; TreeView.Selected := Node; Index: objinspstrconsts.pas =================================================================== --- objinspstrconsts.pas (revision 51031) +++ objinspstrconsts.pas (working copy) @@ -134,6 +134,7 @@ sccsILEdtGrpLCaption = 'Images'; sccsILEdtGrpRCaption = 'Selected Image'; sccsILEdtAdd = '&Add ...'; + sccsILEdtReplace = '&Replace ...'; sccsILEdtDelete = '&Delete'; sccsILEdtApply = '&Apply'; sccsILEdtClear = '&Clear'; @@ -158,6 +159,7 @@ rscdVisible = 'Visible'; rscdAutoSize = 'Auto Size'; sccsILEdtOpenDialog = 'Add Images'; + sccsILEdtOpenDialogN = 'New Image'; sccsILEdtSaveDialog = 'Save Image'; // StringGrid Editor @@ -379,6 +381,7 @@ // image list editor s_SuggestSplitImage = 'Do you want to split the image?'; + s_Confirm_Clear = 'Are you sure to clear image list?'; s_AddAsSingle = 'Add as single'; s_SplitImage = 'Split image'; |
|
imagelist_editor.patch (12,559 bytes)
Index: components/ideintf/imagelisteditor.lfm =================================================================== --- components/ideintf/imagelisteditor.lfm (revision 51031) +++ components/ideintf/imagelisteditor.lfm (working copy) @@ -1,7 +1,7 @@ object ImageListEditorDlg: TImageListEditorDlg - Left = 302 + Left = 453 Height = 379 - Top = 191 + Top = 144 Width = 616 BorderIcons = [biSystemMenu, biHelp] Caption = 'ImagesList Editor' @@ -12,7 +12,7 @@ OnCreate = FormCreate OnDestroy = FormDestroy Position = poScreenCenter - LCLVersion = '1.1' + LCLVersion = '1.7' object GroupBoxR: TGroupBox AnchorSideTop.Control = Owner AnchorSideRight.Control = Owner @@ -19,20 +19,20 @@ AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = BtnPanel Left = 376 - Height = 328 + Height = 335 Top = 6 Width = 234 Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Around = 6 Caption = 'Selected Image' - ClientHeight = 310 + ClientHeight = 315 ClientWidth = 230 TabOrder = 1 object LabelTransparent: TLabel Left = 110 Height = 15 - Top = 203 - Width = 92 + Top = 208 + Width = 98 Anchors = [akLeft, akBottom] BorderSpacing.Around = 6 Caption = 'Transparent Color:' @@ -47,11 +47,11 @@ end object Preview: TScrollBox Left = 6 - Height = 162 + Height = 167 Top = 32 Width = 217 - HorzScrollBar.Page = 213 - VertScrollBar.Page = 158 + HorzScrollBar.Page = 1 + VertScrollBar.Page = 1 Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Around = 6 Color = clGrayText @@ -62,7 +62,7 @@ object RadioGroup: TRadioGroup Left = 7 Height = 105 - Top = 200 + Top = 205 Width = 96 Anchors = [akLeft, akBottom] AutoFill = True @@ -76,7 +76,7 @@ ChildSizing.ShrinkVertical = crsScaleChilds ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.ControlsPerLine = 1 - ClientHeight = 87 + ClientHeight = 85 ClientWidth = 92 Enabled = False ItemIndex = 0 @@ -93,8 +93,8 @@ AnchorSideTop.Control = LabelTransparent AnchorSideTop.Side = asrBottom Left = 110 - Height = 24 - Top = 224 + Height = 22 + Top = 229 Width = 96 Selected = clFuchsia Style = [cbStandardColors, cbExtendedColors, cbIncludeDefault, cbCustomColor, cbPrettyNames] @@ -109,13 +109,13 @@ AnchorSideTop.Control = Owner AnchorSideBottom.Control = BtnPanel Left = 6 - Height = 328 + Height = 335 Top = 6 Width = 364 Anchors = [akTop, akLeft, akBottom] BorderSpacing.Around = 6 Caption = 'Images' - ClientHeight = 310 + ClientHeight = 315 ClientWidth = 360 TabOrder = 0 object TreeView: TTreeView @@ -122,12 +122,12 @@ AnchorSideLeft.Control = GroupBoxL AnchorSideTop.Control = GroupBoxL Left = 6 - Height = 299 + Height = 304 Top = 6 Width = 186 Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Around = 6 - DefaultItemHeight = 16 + DefaultItemHeight = 18 HideSelection = False Images = ImageList ReadOnly = True @@ -166,30 +166,30 @@ AnchorSideRight.Side = asrBottom Left = 198 Height = 25 - Top = 68 + Top = 99 Width = 156 Anchors = [akTop, akLeft, akRight] BorderSpacing.Around = 6 Caption = 'Clear' OnClick = BtnClearClick - TabOrder = 3 + TabOrder = 4 end object BtnDelete: TButton AnchorSideLeft.Control = TreeView AnchorSideLeft.Side = asrBottom - AnchorSideTop.Control = BtnAdd + AnchorSideTop.Control = BtnReplace AnchorSideTop.Side = asrBottom AnchorSideRight.Control = GroupBoxL AnchorSideRight.Side = asrBottom Left = 198 Height = 25 - Top = 37 + Top = 68 Width = 156 Anchors = [akTop, akLeft, akRight] BorderSpacing.Around = 6 Caption = '&Delete' OnClick = BtnDeleteClick - TabOrder = 2 + TabOrder = 3 end object BtnMoveUp: TButton Tag = -1 @@ -201,13 +201,13 @@ AnchorSideRight.Side = asrBottom Left = 198 Height = 25 - Top = 99 + Top = 130 Width = 156 Anchors = [akTop, akLeft, akRight] BorderSpacing.Around = 6 Caption = 'Move Up' OnClick = BtnMoveUpClick - TabOrder = 4 + TabOrder = 5 end object BtnMoveDown: TButton Tag = 1 @@ -219,13 +219,13 @@ AnchorSideRight.Side = asrBottom Left = 198 Height = 25 - Top = 130 + Top = 161 Width = 156 Anchors = [akTop, akLeft, akRight] BorderSpacing.Around = 6 Caption = 'Move Down' OnClick = BtnMoveUpClick - TabOrder = 5 + TabOrder = 6 end object BtnSave: TButton AnchorSideLeft.Control = TreeView @@ -236,34 +236,53 @@ AnchorSideRight.Side = asrBottom Left = 198 Height = 25 - Top = 161 + Top = 192 Width = 156 Anchors = [akTop, akLeft, akRight] BorderSpacing.Around = 6 Caption = 'Save...' OnClick = BtnSaveClick - TabOrder = 6 + TabOrder = 7 end object btnSaveAll: TButton AnchorSideLeft.Control = TreeView AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = BtnSave + AnchorSideTop.Side = asrBottom AnchorSideRight.Control = GroupBoxL AnchorSideRight.Side = asrBottom Left = 198 Height = 25 - Top = 194 + Top = 223 Width = 156 Anchors = [akTop, akLeft, akRight] BorderSpacing.Around = 6 Caption = 'Save All...' OnClick = btnSaveAllClick - TabOrder = 7 + TabOrder = 8 end + object BtnReplace: TButton + AnchorSideLeft.Control = TreeView + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = BtnAdd + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = GroupBoxL + AnchorSideRight.Side = asrBottom + Left = 198 + Height = 25 + Top = 37 + Width = 156 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Around = 6 + Caption = '&Replace...' + OnClick = BtnReplaceClick + TabOrder = 2 + end end object BtnPanel: TButtonPanel Left = 6 - Height = 33 - Top = 340 + Height = 26 + Top = 347 Width = 604 OKButton.Name = 'OKButton' OKButton.DefaultCaption = True Index: components/ideintf/imagelisteditor.pp =================================================================== --- components/ideintf/imagelisteditor.pp (revision 51031) +++ components/ideintf/imagelisteditor.pp (working copy) @@ -47,6 +47,7 @@ BtnAdd: TButton; BtnClear: TButton; BtnDelete: TButton; + BtnReplace: TButton; BtnMoveUp: TButton; BtnMoveDown: TButton; BtnSave: TButton; @@ -66,6 +67,7 @@ procedure BtnAddClick(Sender: TObject); procedure BtnClearClick(Sender: TObject); procedure BtnDeleteClick(Sender: TObject); + procedure BtnReplaceClick(Sender: TObject); procedure BtnMoveUpClick(Sender: TObject); procedure btnSaveAllClick(Sender: TObject); procedure BtnSaveClick(Sender: TObject); @@ -85,7 +87,7 @@ procedure LoadFromImageList(AImageList: TImageList); procedure SaveToImageList; - procedure AddImageToList(const FileName: String); + procedure AddImageToList(const FileName: String; Insert : Boolean); end; //Editor call by Lazarus with 1 verbe only @@ -192,6 +194,7 @@ BtnAdd.Caption := sccsILEdtAdd; BtnDelete.Caption := sccsILEdtDelete; + BtnReplace.Caption := sccsILEdtReplace; BtnClear.Caption := sccsILEdtClear; BtnMoveUp.Caption := sccsILEdtMoveUp; BtnMoveDown.Caption := sccsILEdtMoveDown; @@ -229,6 +232,8 @@ var I: Integer; begin + OpenDialog.Title := sccsILEdtOpenDialog; + OpenDialog.Options:=OpenDialog.Options+[ofAllowMultiSelect]; if OpenDialog.Execute then begin ImageList.BeginUpdate; @@ -235,7 +240,7 @@ TreeView.BeginUpdate; try for I := 0 to OpenDialog.Files.Count - 1 do - AddImageToList(TrimRight(OpenDialog.Files[I])); + AddImageToList(TrimRight(OpenDialog.Files[I]),False); finally TreeView.EndUpdate; ImageList.EndUpdate; @@ -246,8 +251,14 @@ procedure TImageListEditorDlg.BtnClearClick(Sender: TObject); begin - ImageList.Clear; - TreeView.Items.Clear; + if TreeView.Items.Count=0 then exit; + if (IDEQuestionDialog(Caption, + s_Confirm_Clear, mtConfirmation, + [mrYes, mrNo]) = mrYes) then + begin + ImageList.Clear; + TreeView.Items.Clear; + end; end; procedure TImageListEditorDlg.BtnDeleteClick(Sender: TObject); @@ -280,6 +291,41 @@ TreeView.SetFocus; end; +procedure TImageListEditorDlg.BtnReplaceClick(Sender: TObject); +var + S,N: Integer; Node: TTreeNode; +begin + if Assigned(TreeView.Selected) then + begin + Node := TreeView.Selected; + OpenDialog.Title := sccsILEdtOpenDialogN; + OpenDialog.Options:=OpenDialog.Options-[ofAllowMultiSelect]; + if OpenDialog.Execute then + begin + ImageList.BeginUpdate; + TreeView.BeginUpdate; + try + AddImageToList(TrimRight(OpenDialog.FileName),True); + S:=TreeView.Selected.ImageIndex-1; + ImageList.Delete(S); + TreeView.Selected.ImageIndex:=S+1; + TreeView.Selected.Delete; + for N := S to TreeView.Items.Count-1 do + begin + TreeView.Items[N].Text := IntToStr(N); + TreeView.Items[N].ImageIndex := N; + TreeView.Items[N].SelectedIndex := N; + end; + TreeView.Selected:=Node; + finally + TreeView.EndUpdate; + ImageList.EndUpdate; + end; + TreeView.SetFocus; + end; + end; +end; + procedure TImageListEditorDlg.BtnMoveUpClick(Sender: TObject); var S, D: Integer; @@ -514,7 +560,7 @@ FModified := True; end; -procedure TImageListEditorDlg.AddImageToList(const FileName: String); +procedure TImageListEditorDlg.AddImageToList(const FileName: String;Insert:boolean); var SrcBmp: TBitmap; Picture: TPicture; @@ -557,7 +603,7 @@ end; //Ask the user if wants to split the source image if ((ImagesPerRow > 1) or (ImagesPerColumn > 1)) - and (IDEQuestionDialog(Caption +' - '+ btnAdd.Caption, + and (IDEQuestionDialog(Caption, s_SuggestSplitImage, mtConfirmation, [mrNo, s_AddAsSingle, mrYes, s_SplitImage]) <> mrYes) then begin @@ -576,8 +622,16 @@ P^.Adjustment := gaNone; P^.TransparentColor := clDefault; - I := ImageList.Add(P^.Bitmap, nil); - Node := TreeView.Items.AddObject(nil, IntToStr(I), P); + if Insert then + begin + I := TreeView.Selected.ImageIndex+1; + ImageList.Insert(I,P^.Bitmap, nil); + Node := TreeView.Items.InsertObjectBehind(TreeView.Selected, IntToStr(I), P); + end else + begin + I := ImageList.Add(P^.Bitmap, nil); + Node := TreeView.Items.AddObject(nil, IntToStr(I), P); + end; Node.ImageIndex := I; Node.SelectedIndex := I; TreeView.Selected := Node; Index: components/ideintf/objinspstrconsts.pas =================================================================== --- components/ideintf/objinspstrconsts.pas (revision 51031) +++ components/ideintf/objinspstrconsts.pas (working copy) @@ -134,6 +134,7 @@ sccsILEdtGrpLCaption = 'Images'; sccsILEdtGrpRCaption = 'Selected Image'; sccsILEdtAdd = '&Add ...'; + sccsILEdtReplace = '&Replace ...'; sccsILEdtDelete = '&Delete'; sccsILEdtApply = '&Apply'; sccsILEdtClear = '&Clear'; @@ -158,6 +159,7 @@ rscdVisible = 'Visible'; rscdAutoSize = 'Auto Size'; sccsILEdtOpenDialog = 'Add Images'; + sccsILEdtOpenDialogN = 'New Image'; sccsILEdtSaveDialog = 'Save Image'; // StringGrid Editor @@ -379,6 +381,7 @@ // image list editor s_SuggestSplitImage = 'Do you want to split the image?'; + s_Confirm_Clear = 'Are you sure to clear image list?'; s_AddAsSingle = 'Add as single'; s_SplitImage = 'Split image'; |
|
Added new patch with full pathes. |
|
Very good. Applied, thanks. |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-12-25 16:57 | Janusz Tomczak | New Issue | |
2015-12-25 16:57 | Janusz Tomczak | File Added: ideintf.patch | |
2015-12-25 18:34 | Janusz Tomczak | File Added: imagelist_editor.patch | |
2015-12-25 18:35 | Janusz Tomczak | Note Added: 0088244 | |
2015-12-27 14:48 | Ondrej Pokorny | Assigned To | => Ondrej Pokorny |
2015-12-27 14:48 | Ondrej Pokorny | Status | new => assigned |
2015-12-27 18:41 | Ondrej Pokorny | Fixed in Revision | => 51054 |
2015-12-27 18:41 | Ondrej Pokorny | LazTarget | => 1.8 |
2015-12-27 18:41 | Ondrej Pokorny | Note Added: 0088320 | |
2015-12-27 18:41 | Ondrej Pokorny | Status | assigned => resolved |
2015-12-27 18:41 | Ondrej Pokorny | Fixed in Version | => 1.7 (SVN) |
2015-12-27 18:41 | Ondrej Pokorny | Resolution | open => fixed |
2015-12-27 19:41 | Janusz Tomczak | Status | resolved => closed |