Re: [Lazarus] Alternative component palette layout
First of all: HAPPY NEW YEAR! ComponentsListView should be read only. Please apply attached patch if OK. Sandro On 31 December 2014 at 18:46, Sandro Cumerlato sandro.cumerl...@gmail.com wrote: Hello Juha, I've implemented (auto) resize of Components list columns. Please review attached patch and apply if OK. Sandro On 28 December 2014 at 21:11, Juha Manninen juha.mannine...@gmail.com wrote: On Sun, Dec 28, 2014 at 1:08 PM, zeljko zel...@holobit.net wrote: I'm against such workarounds since it can hide bug. Is it enough to comment code LCLQt to completely disable LCLQt ifdef ? I'll try to debug and see what exactly happens, since it's impossible to reproduce it with simple example project. I already thought I spotted the error and I almost opened a bug report. Unneeded pages are deleted like : Application.ReleaseComponent(Sheet); I could reproduce the error in a small test project and then fix it using : TabControl := TCustomTabControl(PageControl1); TabControl.Pages.Delete(0); But ... I tried to use it in the component palette code and it didn't work. I am puzzled and will not touch this issue for a while. TPageControl API sucks badly. TPageControl inherits from TCustomTabControl. They both have Pages but with different meaning. There is Pages[] and Page[]. I think it should be fixed even if it breaks Delphi compatibility. Anyway, the palette reordering works pretty much perfectly now! Giuliano made a workaround for the QT issue and I fixed a last remaining bug related to saving the configuration. Please everybody test and create alternative palette layouts. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus Index: ide/frames/componentpalette_options.lfm === --- ide/frames/componentpalette_options.lfm (revisione 47275) +++ ide/frames/componentpalette_options.lfm (copia locale) @@ -235,6 +235,7 @@ 54657374436F6D70080054657374506167650B00546573745061636B 616765 } + ReadOnly = True RowSelect = True ScrollBars = ssAutoBoth TabOrder = 0 -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
On Thu, 1 Jan 2015 10:49:56 +0100 Sandro Cumerlato sandro.cumerl...@gmail.com wrote: First of all: HAPPY NEW YEAR! ComponentsListView should be read only. Please apply attached patch if OK. Thanks. Applied. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
Hello Juha, I've implemented (auto) resize of Components list columns. Please review attached patch and apply if OK. Sandro On 28 December 2014 at 21:11, Juha Manninen juha.mannine...@gmail.com wrote: On Sun, Dec 28, 2014 at 1:08 PM, zeljko zel...@holobit.net wrote: I'm against such workarounds since it can hide bug. Is it enough to comment code LCLQt to completely disable LCLQt ifdef ? I'll try to debug and see what exactly happens, since it's impossible to reproduce it with simple example project. I already thought I spotted the error and I almost opened a bug report. Unneeded pages are deleted like : Application.ReleaseComponent(Sheet); I could reproduce the error in a small test project and then fix it using : TabControl := TCustomTabControl(PageControl1); TabControl.Pages.Delete(0); But ... I tried to use it in the component palette code and it didn't work. I am puzzled and will not touch this issue for a while. TPageControl API sucks badly. TPageControl inherits from TCustomTabControl. They both have Pages but with different meaning. There is Pages[] and Page[]. I think it should be fixed even if it breaks Delphi compatibility. Anyway, the palette reordering works pretty much perfectly now! Giuliano made a workaround for the QT issue and I fixed a last remaining bug related to saving the configuration. Please everybody test and create alternative palette layouts. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus Index: ide/frames/componentpalette_options.lfm === --- ide/frames/componentpalette_options.lfm (revisione 47273) +++ ide/frames/componentpalette_options.lfm (copia locale) @@ -216,17 +216,17 @@ end item Caption = 'Name' - MaxWidth = 300 MinWidth = 50 Width = 145 end item Caption = 'Page' - MaxWidth = 1000 + MinWidth = 50 Width = 201 end item - Caption = 'Package' + Caption = 'Unit' + MinWidth = 50 Width = 301 end DragMode = dmAutomatic Index: ide/frames/componentpalette_options.pas === --- ide/frames/componentpalette_options.pas (revisione 47273) +++ ide/frames/componentpalette_options.pas (copia locale) @@ -313,9 +313,18 @@ PageCnt, CompCnt: Integer; StartInd, EndInd: Integer; RealPageName, CompName: String; + bListAll : Boolean; + TempWidth, + NameWidth, + PageWidth, + UnitWidth : Integer; begin - if aPageName = lis_All_ then + bListAll := aPageName = lis_All_; + if bListAll then begin +NameWidth := 50; +PageWidth := 50; +UnitWidth := 50; StartInd := 1;// Skip the first entry for all components. EndInd := PagesListBox.Count-1; end @@ -338,8 +347,23 @@ Item.SubItems.Add(RealPageName); Item.SubItems.Add(Comp.GetUnitName); Item.Data := Comp; + if bListAll then + begin +TempWidth := 20 + ComponentsListView.Canvas.GetTextWidth(CompName); +if TempWidth NameWidth then NameWidth := TempWidth; +TempWidth := 20 + ComponentsListView.Canvas.GetTextWidth(RealPageName); +if TempWidth PageWidth then PageWidth := TempWidth; +TempWidth := 20 + ComponentsListView.Canvas.GetTextWidth(Comp.GetUnitName); +if TempWidth UnitWidth then UnitWidth := TempWidth; + end; end; end; + if bListAll then + begin +ComponentsListView.Column[1].Width := NameWidth; +ComponentsListView.Column[2].Width := PageWidth; +ComponentsListView.Column[3].Width := UnitWidth; + end; ComponentsListView.Items.EndUpdate; end; -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
On 12/27/2014 06:45 PM, Giuliano Colla wrote: Il 27/12/2014 17:35, Juha Manninen ha scritto: On Sat, Dec 27, 2014 at 4:56 PM, Giuliano Colla giuliano.co...@fastwebnet.it wrote: However I've found a simple workaround: with Qt ws, to remove the old tab before calling InsertVisiblePage. That way PageComponent is always nil, and everything works just fine. If you agree, I can commit my change (it's really minimal) and you may check it. Yes, that workaround would prevent moving tabs and it could be added with IFDEF LCLQt. Committed with rev 47255. You'll find the workaround (surrounded by the IFDEF LCLQt) + some added Debugln + a minor fix (a ShowHint := true was missing) + an attempt to use a different code for moving tabs (surrounded by an IFDEF USE_PageIndex). It doesn't make any difference but it saves a number of tests, because they're done in LCL. You may keep it or throw it away following your taste. I'm against such workarounds since it can hide bug. Is it enough to comment code LCLQt to completely disable LCLQt ifdef ? I'll try to debug and see what exactly happens, since it's impossible to reproduce it with simple example project. zeljko The bug is most likely a regression in recent QT versions. I applied the change from Zeljko. It uses QTabBar_moveTab and is an improvement but still does not solve the problem. I see if I can reproduce it in a small test application. I hope you'll have better chance than me. I tried with a small test application, but no way to reproduce the bug. Tabs were always inserted/moved properly. True, I did use just standard components i.e. a standard NoteBook with standart TabSheet, and my tabs didn't come from a StringList, but I don't see how this should make a difference. The Qt code involved was exactly the same, as far as I can tell, and my debugln's tell. Giuliano -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
On Sun, Dec 28, 2014 at 1:08 PM, zeljko zel...@holobit.net wrote: I'm against such workarounds since it can hide bug. Is it enough to comment code LCLQt to completely disable LCLQt ifdef ? I'll try to debug and see what exactly happens, since it's impossible to reproduce it with simple example project. I already thought I spotted the error and I almost opened a bug report. Unneeded pages are deleted like : Application.ReleaseComponent(Sheet); I could reproduce the error in a small test project and then fix it using : TabControl := TCustomTabControl(PageControl1); TabControl.Pages.Delete(0); But ... I tried to use it in the component palette code and it didn't work. I am puzzled and will not touch this issue for a while. TPageControl API sucks badly. TPageControl inherits from TCustomTabControl. They both have Pages but with different meaning. There is Pages[] and Page[]. I think it should be fixed even if it breaks Delphi compatibility. Anyway, the palette reordering works pretty much perfectly now! Giuliano made a workaround for the QT issue and I fixed a last remaining bug related to saving the configuration. Please everybody test and create alternative palette layouts. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
On Fri, Dec 26, 2014 at 2:04 PM, Giuliano Colla giuliano.co...@fastwebnet.it wrote: The patch has no effect, but I suspect that the problem is elsewhere, because in my tests the TabControl.Pages.Move() is never called. That is not true. It is called from TComponentPage.InsertVisiblePage for any existing page that gets a new position index. Just debug it if you don't believe. You also wrote that you recreated the whole modern layout for your palette setup. It should not be needed. Non-existent components are skipped and you should be able to import any configuration. If you get an error during the import, then there is another bug. I start to suspect you have local changes in your code which cause the errors. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
Il 27/12/2014 11:04, Juha Manninen ha scritto: On Fri, Dec 26, 2014 at 2:04 PM, Giuliano Colla giuliano.co...@fastwebnet.it wrote: The patch has no effect, but I suspect that the problem is elsewhere, because in my tests the TabControl.Pages.Move() is never called. That is not true. It is called from TComponentPage.InsertVisiblePage for any existing page that gets a new position index. Just debug it if you don't believe. You are right. I found out that it depends on the difference between the old and the new layout. It's not called with my layout, it's called with yours. With my layout, it happens that the move performed in CreatePagesFromUserOrder is already the good one. Just a coincidence. You also wrote that you recreated the whole modern layout for your palette setup. It should not be needed. Non-existent components are skipped and you should be able to import any configuration. If you get an error during the import, then there is another bug. It was just for testing purpose. I didn't get errors during the import of the Modern layout, I only had misplaced tabs with Qt. With my layout I didn't have misplaced tabs with the import, but I had when restoring the default. Just because of a slightly different order of tabs. I start to suspect you have local changes in your code which cause the errors. svn diff doesn't show anything strange, and the only problem is with Qt ws, and in a very specific condition: 1) a number of tabs are added in the first positions (0,1,2 in one of my tests) 2) some are skipped because they are already in place (3,4,5,6 ) 3) a new tab should be inserted just after those skipped (index = 7) and goes instead before them ( at position 3). Everything tells that it goes to index 7, up to TQtTabWidgetset.insertTab(), but it shows at index 3! Then of course everything goes astray, because the tab index are out of sync. I suspect that the problem arises from tab components being possibly shared by two widgets: I can see that at start, there are two InsertTab sequences: one with the number of visible tabs of the selected layout, and another one with all the tabs. It's possible that different widgetsets behave differently in this condition. My question is: is it necessary? However I've found a simple workaround: with Qt ws, to remove the old tab before calling InsertVisiblePage. That way PageComponent is always nil, and everything works just fine. If you agree, I can commit my change (it's really minimal) and you may check it. Giuliano -- Giuliano Colla Project planning question: when it's 90% done, are we halfway or not yet? -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
Il 27/12/2014 15:56, Giuliano Colla ha scritto: I suspect that the problem arises from tab components being possibly shared by two widgets: I can see that at start, there are two InsertTab sequences: one with the number of visible tabs of the selected layout, and another one with all the tabs. It's possible that different widgetsets behave differently in this condition. My question is: is it necessary? Please ignore this paragraph! The second InsertTab sequence is for the source editor tabs! I had not realized it! Giuliano -- Giuliano Colla Project planning question: when it's 90% done, are we halfway or not yet? -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
On Sat, Dec 27, 2014 at 4:56 PM, Giuliano Colla giuliano.co...@fastwebnet.it wrote: However I've found a simple workaround: with Qt ws, to remove the old tab before calling InsertVisiblePage. That way PageComponent is always nil, and everything works just fine. If you agree, I can commit my change (it's really minimal) and you may check it. Yes, that workaround would prevent moving tabs and it could be added with IFDEF LCLQt. The bug is most likely a regression in recent QT versions. I applied the change from Zeljko. It uses QTabBar_moveTab and is an improvement but still does not solve the problem. I see if I can reproduce it in a small test application. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
On Sat, Dec 27, 2014 at 6:35 PM, Juha Manninen juha.mannine...@gmail.com wrote: I see if I can reproduce it in a small test application. I cannot reproduce it. I give up. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
Il 27/12/2014 17:35, Juha Manninen ha scritto: On Sat, Dec 27, 2014 at 4:56 PM, Giuliano Colla giuliano.co...@fastwebnet.it wrote: However I've found a simple workaround: with Qt ws, to remove the old tab before calling InsertVisiblePage. That way PageComponent is always nil, and everything works just fine. If you agree, I can commit my change (it's really minimal) and you may check it. Yes, that workaround would prevent moving tabs and it could be added with IFDEF LCLQt. Committed with rev 47255. You'll find the workaround (surrounded by the IFDEF LCLQt) + some added Debugln + a minor fix (a ShowHint := true was missing) + an attempt to use a different code for moving tabs (surrounded by an IFDEF USE_PageIndex). It doesn't make any difference but it saves a number of tests, because they're done in LCL. You may keep it or throw it away following your taste. The bug is most likely a regression in recent QT versions. I applied the change from Zeljko. It uses QTabBar_moveTab and is an improvement but still does not solve the problem. I see if I can reproduce it in a small test application. I hope you'll have better chance than me. I tried with a small test application, but no way to reproduce the bug. Tabs were always inserted/moved properly. True, I did use just standard components i.e. a standard NoteBook with standart TabSheet, and my tabs didn't come from a StringList, but I don't see how this should make a difference. The Qt code involved was exactly the same, as far as I can tell, and my debugln's tell. Giuliano -- Giuliano Colla Project planning question: when it's 90% done, are we halfway or not yet? -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
Il 22/12/2014 10:05, zeljko ha scritto: On 12/22/2014 12:29 AM, Juha Manninen wrote: On Sun, Dec 21, 2014 at 5:27 PM, zeljko zel...@holobit.net wrote: What could be exact bug with Qt ? Any example project ? What is exactly affected ? My main suspect now is line : TabControl.Pages.Move(TabIndex, Pal.fVisiblePageIndex); in TComponentPage.InsertVisiblePage. It moves an exising tab to its new position. I noticed that the missing tabs are always the ones that existed before doing import. Thus they are not inserted but moved. New tabs are inserted : TabControl.Pages.Insert(Pal.fVisiblePageIndex, PageName); but it apparently causes no problems. hmm...it works fine here, but anyway, I've changed tabMove a bit, patch is attached, so pls test if it's ok now. The patch has no effect, but I suspect that the problem is elsewhere, because in my tests the TabControl.Pages.Move() is never called. Giuliano -- Giuliano Colla Project planning question: when it's 90% done, are we halfway or not yet? -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
Il 22/12/2014 10:05, zeljko ha scritto: On 12/22/2014 12:29 AM, Juha Manninen wrote: On Sun, Dec 21, 2014 at 5:27 PM, zeljko zel...@holobit.net wrote: What could be exact bug with Qt ? Any example project ? What is exactly affected ? My main suspect now is line : TabControl.Pages.Move(TabIndex, Pal.fVisiblePageIndex); in TComponentPage.InsertVisiblePage. It moves an exising tab to its new position. I noticed that the missing tabs are always the ones that existed before doing import. Thus they are not inserted but moved. New tabs are inserted : TabControl.Pages.Insert(Pal.fVisiblePageIndex, PageName); but it apparently causes no problems. I've added some more Debugln's and made some more tests. I've painfully rebuilt from scratch the Modern layout, for my current palette setup. Import works just fine, but what fails is restoring the default layout. The debug lines, after restore defaults tell: TComponentPalette.UpdateNoteBookButtons: FPageCount before=14 TComponentPalette.UpdateNoteBookButtons: FPageCount after=14 PageCount=19 TComponentPalette.InsertVisiblePage: Inserting Page=Standard, at index=0 TComponentPalette.UpdateNoteBookButtons: PageIndex=0 PageName=Standard TComponentPalette.InsertVisiblePage: Inserting Page=Additional, at index=1 TComponentPalette.UpdateNoteBookButtons: PageIndex=1 PageName=Additional TComponentPalette.InsertVisiblePage: Inserting Page=Common Controls, at index=2 TComponentPalette.UpdateNoteBookButtons: PageIndex=2 PageName=Common Controls Pages Dialog, Data Control Data Access and System appear to be already in their position and are not moved (which is wrong): TComponentPalette.InsertVisiblePage: Start moving Page=Dialogs from 3 to 3 TComponentPalette.UpdateNoteBookButtons: PageIndex=3 PageName=Dialogs TComponentPalette.InsertVisiblePage: Start moving Page=Data Controls from 4 to 4 TComponentPalette.UpdateNoteBookButtons: PageIndex=4 PageName=Data Controls TComponentPalette.InsertVisiblePage: Start moving Page=Data Access from 5 to 5 TComponentPalette.UpdateNoteBookButtons: PageIndex=5 PageName=Data Access TComponentPalette.InsertVisiblePage: Start moving Page=System from 6 to 6 TComponentPalette.UpdateNoteBookButtons: PageIndex=6 PageName=System Now page Misc should be added at index 7, but actually it is inserted in position 3, while the content is the one of the actual page 3 (i.e. Dialogs). The rest is inconsistent accordingly. Pages which should be moved aren't moved, and the content is inconsistent. TComponentPalette.InsertVisiblePage: Inserting Page=Misc, at index=7 TComponentPalette.UpdateNoteBookButtons: PageIndex=7 PageName=Misc TComponentPalette.InsertVisiblePage: Start moving Page=LazControls from 8 to 8 TComponentPalette.UpdateNoteBookButtons: PageIndex=8 PageName=LazControls TComponentPalette.InsertVisiblePage: Start moving Page=Cairo from 9 to 9 TComponentPalette.UpdateNoteBookButtons: PageIndex=9 PageName=Cairo TComponentPalette.InsertVisiblePage: Start moving Page=Extra from 10 to 10 TComponentPalette.UpdateNoteBookButtons: PageIndex=10 PageName=Extra TComponentPalette.InsertVisiblePage: Inserting Page=MultiLog, at index=11 TComponentPalette.UpdateNoteBookButtons: PageIndex=11 PageName=MultiLog TComponentPalette.InsertVisiblePage: Start moving Page=Pascal Script from 12 to 12 TComponentPalette.UpdateNoteBookButtons: PageIndex=12 PageName=Pascal Script TComponentPalette.InsertVisiblePage: Start moving Page=RTTI from 13 to 13 TComponentPalette.UpdateNoteBookButtons: PageIndex=13 PageName=RTTI TComponentPalette.InsertVisiblePage: Start moving Page=SQLdb from 14 to 14 TComponentPalette.UpdateNoteBookButtons: PageIndex=14 PageName=SQLdb TComponentPalette.InsertVisiblePage: Start moving Page=SynEdit from 15 to 15 TComponentPalette.UpdateNoteBookButtons: PageIndex=15 PageName=SynEdit TComponentPalette.InsertVisiblePage: Start moving Page=Chart from 16 to 16 TComponentPalette.UpdateNoteBookButtons: PageIndex=16 PageName=Chart TComponentPalette.InsertVisiblePage: Start moving Page=IPro from 17 to 17 TComponentPalette.UpdateNoteBookButtons: PageIndex=17 PageName=IPro TComponentPalette.InsertVisiblePage: Start moving Page=fpWeb from 18 to 18 TComponentPalette.UpdateNoteBookButtons: PageIndex=18 PageName=fpWeb Does this trace tell something to someone who wrote the code? Giuliano -- Giuliano Colla Project planning question: when it's 90% done, are we halfway or not yet? -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
Il 26/12/2014 13:23, Giuliano Colla ha scritto: Il 22/12/2014 10:05, zeljko ha scritto: On 12/22/2014 12:29 AM, Juha Manninen wrote: On Sun, Dec 21, 2014 at 5:27 PM, zeljko zel...@holobit.net wrote: What could be exact bug with Qt ? Any example project ? What is exactly affected ? My main suspect now is line : TabControl.Pages.Move(TabIndex, Pal.fVisiblePageIndex); in TComponentPage.InsertVisiblePage. It moves an exising tab to its new position. I noticed that the missing tabs are always the ones that existed before doing import. Thus they are not inserted but moved. New tabs are inserted : TabControl.Pages.Insert(Pal.fVisiblePageIndex, PageName); but it apparently causes no problems. I've added some more Debugln's and made some more tests. I've painfully rebuilt from scratch the Modern layout, for my current palette setup. Import works just fine, but what fails is restoring the default layout. [...] More tests. The move is performed in CreatePagesFromUserOrder(): TComponentPalette.Update, calling UpdateNoteBookButtons, fUpdatingPageControl=False, fNoteBookNeedsUpdate=False TComponentPalette.CreatePagesFromUserOrder, move Standard from 8 to 0 TComponentPalette.CreatePagesFromUserOrder, move Additional from 9 to 1 TComponentPalette.CreatePagesFromUserOrder, move Common Controls from 10 to 2 TComponentPalette.CreatePagesFromUserOrder, move Dialogs from 11 to 3 TComponentPalette.CreatePagesFromUserOrder HideControls=False aVisibleCompCnt=14 TComponentPalette.CreatePagesFromUserOrder, move Data Controls from 12 to 4 TComponentPalette.CreatePagesFromUserOrder, move Data Access from 13 to 5 TComponentPalette.CreatePagesFromUserOrder, move System from 14 to 6 TComponentPalette.CreatePagesFromUserOrder, move Misc from 15 to 7 TComponentPalette.CreatePagesFromUserOrder, move LazControls from 16 to 8 TComponentPalette.CreatePagesFromUserOrder, move Cairo from 17 to 9 TComponentPalette.CreatePagesFromUserOrder, move Extra from 18 to 10 TComponentPalette.CreatePagesFromUserOrder, move MultiLog from 19 to 11 TComponentPalette.CreatePagesFromUserOrder, move Pascal Script from 20 to 12 TComponentPalette.CreatePagesFromUserOrder, move RTTI from 21 to 13 TComponentPalette.CreatePagesFromUserOrder, move SQLdb from 22 to 14 TComponentPalette.CreatePagesFromUserOrder, move SynEdit from 23 to 15 TComponentPalette.CreatePagesFromUserOrder, move Chart from 24 to 16 TComponentPalette.CreatePagesFromUserOrder, move IPro from 25 to 17 TComponentPalette.CreatePagesFromUserOrder, move fpWeb from 26 to 18 TComponentPalette.CreatePagesFromUserOrder: Deleting left-over page=App non-visual, Index=26 TComponentPalette.CreatePagesFromUserOrder: Deleting left-over page=Other visual, Index=25 TComponentPalette.CreatePagesFromUserOrder: Deleting left-over page=Graphic, Index=24 TComponentPalette.CreatePagesFromUserOrder: Deleting left-over page=Bars, Index=23 TComponentPalette.CreatePagesFromUserOrder: Deleting left-over page=Containers, Index=22 TComponentPalette.CreatePagesFromUserOrder: Deleting left-over page=Multi-line Edits, Index=21 TComponentPalette.CreatePagesFromUserOrder: Deleting left-over page=Edits, Index=20 TComponentPalette.CreatePagesFromUserOrder: Deleting left-over page=Buttons, Index=19 Then InsertVisiblePage() works fine for the first three tabs, which are inserted, but it fails for the Page Dialogs, which should just be left untouched. It's instead mixed up with the first page which should get inserted at index 7. Giuliano -- Giuliano Colla Project planning question: when it's 90% done, are we halfway or not yet? -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
On 12/26/2014 01:04 PM, Giuliano Colla wrote: Il 22/12/2014 10:05, zeljko ha scritto: On 12/22/2014 12:29 AM, Juha Manninen wrote: On Sun, Dec 21, 2014 at 5:27 PM, zeljko zel...@holobit.net wrote: What could be exact bug with Qt ? Any example project ? What is exactly affected ? My main suspect now is line : TabControl.Pages.Move(TabIndex, Pal.fVisiblePageIndex); in TComponentPage.InsertVisiblePage. It moves an exising tab to its new position. I noticed that the missing tabs are always the ones that existed before doing import. Thus they are not inserted but moved. New tabs are inserted : TabControl.Pages.Insert(Pal.fVisiblePageIndex, PageName); but it apparently causes no problems. hmm...it works fine here, but anyway, I've changed tabMove a bit, patch is attached, so pls test if it's ok now. The patch has no effect, but I suspect that the problem is elsewhere, because in my tests the TabControl.Pages.Move() is never called. pretty strange that such bug is shown only with qt widgetset. Patch is more friendly for TabControl.Move() and better than current implementation IMO. Don't know how custom pages works or how it is coded, but setting tabs while config is loading is not good. Is it conceptually working like this: load config,fill tabs, move tabs around, hide tabs which should be hidden ? Or it does it's job one by one tab ? z. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
On 12/22/2014 12:29 AM, Juha Manninen wrote: On Sun, Dec 21, 2014 at 5:27 PM, zeljko zel...@holobit.net wrote: What could be exact bug with Qt ? Any example project ? What is exactly affected ? My main suspect now is line : TabControl.Pages.Move(TabIndex, Pal.fVisiblePageIndex); in TComponentPage.InsertVisiblePage. It moves an exising tab to its new position. I noticed that the missing tabs are always the ones that existed before doing import. Thus they are not inserted but moved. New tabs are inserted : TabControl.Pages.Insert(Pal.fVisiblePageIndex, PageName); but it apparently causes no problems. hmm...it works fine here, but anyway, I've changed tabMove a bit, patch is attached, so pls test if it's ok now. zeljko Index: lcl/interfaces/qt/qtpagecontrol.inc === --- lcl/interfaces/qt/qtpagecontrol.inc (revision 47233) +++ lcl/interfaces/qt/qtpagecontrol.inc (working copy) @@ -314,11 +314,9 @@ TabWidget.BeginUpdate; TabWidget.setUpdatesEnabled(false); - TabWidget.removeTab(Index); - TabWidget.insertTab(NewIndex, Page.Widget, Page.getIcon, Page.getText); + QTabBar_moveTab(QTabBarH(TabWidget.TabBar.Widget), Index, NewIndex); + // DebugLn('TQtWSCustomTabControl.MovePage from Index=',dbgs(Index),' to ',dbgs(NewIndex),' finished.'); TabWidget.setUpdatesEnabled(true); - if TabWidget.getCurrentIndex NewIndex then -TabWidget.setCurrentWidget(Page, True); TabWidget.EndUpdate; end; Index: lcl/interfaces/qt/qtwidgets.pas === --- lcl/interfaces/qt/qtwidgets.pas (revision 47233) +++ lcl/interfaces/qt/qtwidgets.pas (working copy) @@ -903,12 +903,14 @@ private FSavedIndexOnPageChanging: Integer; // used to handle OnPageChanging AllowChange param FTabBarChangedHook: QTabBar_hookH; +FTabBarMovedHook: QTabBar_hookH; public procedure AttachEvents; override; procedure DetachEvents; override; function GetTabRect(const AIndex: integer): TRect; // under some themes tabs doesn't start at 0,0 (eg. MacOSX) function TabBarOffset: TPoint; +procedure SignalTabBarMoved(fromIndex: integer; toIndex: Integer); cdecl; procedure SignalTabBarCurrentChanged(Index: Integer); cdecl; function SlotTabBarMouse(Sender: QObjectH; Event: QEventH): Boolean; cdecl; function EventFilter(Sender: QObjectH; Event: QEventH): Boolean; cdecl; override; @@ -9375,11 +9377,18 @@ begin inherited AttachEvents; FTabBarChangedHook := QTabBar_hook_create(QTabBarH(Widget)); + FTabBarMovedHook := QTabBar_hook_create(QTabBarH(Widget)); QTabBar_hook_hook_currentChanged(FTabBarChangedHook, @SignalTabBarCurrentChanged); + QTabBar_hook_hook_tabMoved(FTabBarMovedHook, @SignalTabBarMoved); end; procedure TQtTabBar.DetachEvents; begin + if FTabBarMovedHook nil then + begin +QTabBar_hook_destroy(FTabBarMovedHook); +FTabBarMovedHook := nil; + end; if FTabBarChangedHook nil then begin QTabBar_hook_destroy(FTabBarChangedHook); @@ -9427,6 +9436,21 @@ end; end; +procedure TQtTabBar.SignalTabBarMoved(fromIndex: integer; toIndex: Integer); + cdecl; +var + ANewIndex: Integer; +begin + if LCLObject = nil then +Exit; + // DebugLn('TQtTabBar.SignalTabBarMoved From=',dbgs(fromIndex),' to ',dbgs(toIndex),' FSavedIndexOnPageChanging=',dbgs(FSavedIndexOnPageChanging)); + if Assigned(FOwner) and not (FOwner.ChildOfComplexWidget = ccwTTabControl) then + begin +ANewIndex := TQtTabWidget(FOwner).GetLCLPageIndex(toIndex); +TQtTabWidget(FOwner).setCurrentWidget(TQtWidget(TCustomTabControl(LCLObject).Page[ANewIndex].Handle), True); + end; +end; + procedure TQtTabBar.SignalTabBarCurrentChanged(Index: Integer); cdecl; var Msg: TLMNotify; @@ -9437,7 +9461,6 @@ if TQtTabWidget(LCLObject.Handle).InUpdate then exit; - FillChar(Msg{%H-}, SizeOf(Msg), 0); Msg.Msg := LM_NOTIFY; FillChar(Hdr{%H-}, SizeOf(Hdr), 0); -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
On Sun, Dec 21, 2014 at 1:35 AM, Giuliano Colla giuliano.co...@fastwebnet.it wrote: It might be a timing issue. Sort of you tell Qt to do something on a new tab when it's not yet finished with the previous one. Actually the total number of tabs turns out to be less than expected. I've tested on a 32 bit dual core @1.33 GHz. I'm setting up a new platform 64 bit quad core @2.5 GHz. As soon as it's fully configured, I'll test there, and see if there's a difference. I don't believe it is a timing issue, AFAIK we are dealing with a single threaded code after all. Is it a bug in QT component or LCL-QT, I don't know. According to my debugging the palette code is correct, and indeed it works with other widgetsets. In fact I still have the same issue when importing the alternative layout. Dialogs page is missing and the following pages are shifted. Maybe it was wishful thinking that it got fixed completely. I don't have any issue when restoring defaults though. Or if you point me to the proper section of code, I may add some delay from one item to the next, just for testing. Delay will hardly work but Application.ProcessMessages could in theory have an effect. Palette is updated in TComponentPalette.UpdateNoteBookButtons. The actual page and button layout is done in : TComponentPage.InsertVisiblePage TComponentPage.CreateButtons + the methods it calls, TComponentPage.ReAlignButtons etc. CreateButtons is called from ReAlignButtons in a delayed way, but that is not a cause for this problem. In TComponentPage.CreateOrDelButton I tested Application.ProcessMessages after the Btn.Parent := aScrollBox;, and also in ComponentPalette.UpdateNoteBookButtons after Pg.InsertVisiblePage. No effect! The layout code is originally from Mattias, I have mostly just refactored it. It reuses existing pages and buttons. The logic was needed originally for the DataModule filtering. Then some buttons are hidded and shown again but their parent is not changed. For that purpose the code works with QT, but according to my extensive debugging it should work for the palette ordering feature, too. The code is optimixed, pages and buttons are destroyed / created only when needed. If you find a workaround, great! The ultimate workaround would be to destroy and recreate everything just like when the IDE starts. Another choice would be to use a special custom pagecontrol instead of the LCL pagecontrol. Remember to compile with VerboseComponentPalette and look at the console output. Debugging with GDB from another Lazarus instance is difficult because using mouse for palette may cause all mouse actions to get blocked. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
On 12/21/2014 03:37 PM, Juha Manninen wrote: On Sun, Dec 21, 2014 at 1:35 AM, Giuliano Colla giuliano.co...@fastwebnet.it wrote: It might be a timing issue. Sort of you tell Qt to do something on a new tab when it's not yet finished with the previous one. Actually the total number of tabs turns out to be less than expected. I've tested on a 32 bit dual core @1.33 GHz. I'm setting up a new platform 64 bit quad core @2.5 GHz. As soon as it's fully configured, I'll test there, and see if there's a difference. I don't believe it is a timing issue, AFAIK we are dealing with a single threaded code after all. Is it a bug in QT component or LCL-QT, I don't know. According to my debugging the palette code is correct, and indeed it works with other widgetsets. What could be exact bug with Qt ? Any example project ? What is exactly affected ? z. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
Sorry for top posting, but this is just to say that I'm currently traveling and unable to test. I had already attempted to insert some Application.processmessages, more or less in the area you suggest, but with no effect. On Tuesday I'll be back and will do some more testing, unless you've already fixed everything in the meanwhile Giuliano Inviato da iPhone Il giorno 21/dic/2014, alle ore 15:37, Juha Manninen juha.mannine...@gmail.com ha scritto: On Sun, Dec 21, 2014 at 1:35 AM, Giuliano Colla giuliano.co...@fastwebnet.it wrote: It might be a timing issue. Sort of you tell Qt to do something on a new tab when it's not yet finished with the previous one. Actually the total number of tabs turns out to be less than expected. I've tested on a 32 bit dual core @1.33 GHz. I'm setting up a new platform 64 bit quad core @2.5 GHz. As soon as it's fully configured, I'll test there, and see if there's a difference. I don't believe it is a timing issue, AFAIK we are dealing with a single threaded code after all. Is it a bug in QT component or LCL-QT, I don't know. According to my debugging the palette code is correct, and indeed it works with other widgetsets. In fact I still have the same issue when importing the alternative layout. Dialogs page is missing and the following pages are shifted. Maybe it was wishful thinking that it got fixed completely. I don't have any issue when restoring defaults though. Or if you point me to the proper section of code, I may add some delay from one item to the next, just for testing. Delay will hardly work but Application.ProcessMessages could in theory have an effect. Palette is updated in TComponentPalette.UpdateNoteBookButtons. The actual page and button layout is done in : TComponentPage.InsertVisiblePage TComponentPage.CreateButtons + the methods it calls, TComponentPage.ReAlignButtons etc. CreateButtons is called from ReAlignButtons in a delayed way, but that is not a cause for this problem. In TComponentPage.CreateOrDelButton I tested Application.ProcessMessages after the Btn.Parent := aScrollBox;, and also in ComponentPalette.UpdateNoteBookButtons after Pg.InsertVisiblePage. No effect! The layout code is originally from Mattias, I have mostly just refactored it. It reuses existing pages and buttons. The logic was needed originally for the DataModule filtering. Then some buttons are hidded and shown again but their parent is not changed. For that purpose the code works with QT, but according to my extensive debugging it should work for the palette ordering feature, too. The code is optimixed, pages and buttons are destroyed / created only when needed. If you find a workaround, great! The ultimate workaround would be to destroy and recreate everything just like when the IDE starts. Another choice would be to use a special custom pagecontrol instead of the LCL pagecontrol. Remember to compile with VerboseComponentPalette and look at the console output. Debugging with GDB from another Lazarus instance is difficult because using mouse for palette may cause all mouse actions to get blocked. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
Il 19/12/2014 18:45, Juha Manninen ha scritto: Did anybody manage to import this palette layout? I fixed the code already some time ago. I did. Apparently no problems with the basic default components, but a number of weird things with the other tabs, such as one tab showing the components of next tab, and some components/tabs which have disappeared. Even Restore default values doesn't manage to restore properly: some components shown in the wrong tab, and/or with wrong Icon. Need to restart Lazarus to really restore. I understand that this is too vague to help you fixing what requires fixing. I'll make some more test trying to isolate the problems, to provide you more information, but it takes time. However, IMHO a palette organized by the end user point of view is a great thing, and it's worth the effort. Good job Juha! Giuliano -- Giuliano Colla Project planning question: when it's 90% done, are we halfway or not yet? -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
On Saturday, December 20, 2014, Giuliano Colla giuliano.co...@fastwebnet.it wrote: I did. Apparently no problems with the basic default components, but a number of weird things with the other tabs, such as one tab showing the components of next tab, and some components/tabs which have disappeared. Even Restore default values doesn't manage to restore properly: some components shown in the wrong tab, and/or with wrong Icon. Need to restart Lazarus to really restore. I understand that this is too vague to help you fixing what requires fixing. I'll make some more test trying to isolate the problems, to provide you more information, but it takes time. You did not mention your widgetset or platform. The problems depend on PageControl behavior on different platforms. I debugged a lot and the configuration code itself is doing the right thing now. For me the whole feature works well with 3 widgetsets, GTK2, QT on Linux and then Windows. I am surprised that you still get so severe errors. QT had redraw problem, one tab disappeared etc., but I got it fixed. But yes, the PageControl update part of component palette is very nasty. Can you verify that the configuration works correctly after restarting the IDE? It would mean there are only redraw problems. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
Il 20/12/2014 14:36, Juha Manninen ha scritto: On Saturday, December 20, 2014, Giuliano Colla giuliano.co...@fastwebnet.it mailto:giuliano.co...@fastwebnet.it wrote: I did. Apparently no problems with the basic default components, but a number of weird things with the other tabs, such as one tab showing the components of next tab, and some components/tabs which have disappeared. Even Restore default values doesn't manage to restore properly: some components shown in the wrong tab, and/or with wrong Icon. Need to restart Lazarus to really restore. I understand that this is too vague to help you fixing what requires fixing. I'll make some more test trying to isolate the problems, to provide you more information, but it takes time. You did not mention your widgetset or platform. The problems depend on PageControl behavior on different platforms. I debugged a lot and the configuration code itself is doing the right thing now. For me the whole feature works well with 3 widgetsets, GTK2, QT on Linux and then Windows. I am surprised that you still get so severe errors. QT had redraw problem, one tab disappeared etc., but I got it fixed. But yes, the PageControl update part of component palette is very nasty. Can you verify that the configuration works correctly after restarting the IDE? It would mean there are only redraw problems. I spent some time testing, and here's my result. It would appear to be a Qt-only problem, but it seems to be a bit more intricate than just a redraw problem. Full scenario: The platform is Linux x86. Test with: 1) A vanilla trunk Lazarus with just Bigide components, nothing else added. 2) A trunk Lazarus with extra components on the palette: a Cairo tab (lui_cairo package), an Extra tab for some components of mine, a multilog tab (TLogTreeView) and an fpWeb tab. Qt Widgetset (the one I'm using normally) With both test cases the result is the same: Importing the Modern palette layout, the first tabs are ok up to LazControls. Then the mess starts. The layout from the Options-Component palette tells that next tab should be Dialogs, while the Tab says App Non-Visual, the palette shows the Dialogs Icons, but the hints are for the non-visual components (TActionList etc.). Next tab is labeled System, it shows the Icons for non-visual, but the items are inactive (no hint, no way to select them). It goes like that up to the end. Restarting Lazarus, everything goes back in place. Then if you restore the Default, it becomes again messy. The Components dialog still shows the Modern layout; after the Misc tab, next Tab is Pascal Script in test 1, Cairo in test 2, but it shows in both cases LazControls, the LazControls tab is moved farther, but it shows the RTTI components, etc. Again you need to restart Lazarus to put things back in place. BTW, testing a number of times, when you change the palette layout, the Components dialog (the one activated with View All) sometimes shows the new tab names but most of the times the previous ones. GTK2 widgetset. It behaves as expected, with the only note that View All when importing the new layout is properly updated, but when you restore the default still keeps the previous palette layout. I noticed that the Export function tells to have successfully exported, but actually it does nothing. I presume that this is because it's work in progress. I hope that it helps, Giuliano -- Giuliano Colla Project planning question: when it's 90% done, are we halfway or not yet? -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
On Sat, Dec 20, 2014 at 9:17 PM, Giuliano Colla giuliano.co...@fastwebnet.it wrote: I spent some time testing, and here's my result. It would appear to be a Qt-only problem, but it seems to be a bit more intricate than just a redraw problem. ... Thanks for your testing. You have a lot more errors with QT than I do. Strange. May be difficult to fix if I cannot reproduce. The good news is that there is a workaround. You can restart Lazarus and the configuration works. GTK2 widgetset. It behaves as expected, with the only note that View All when importing the new layout is properly updated, but when you restore the default still keeps the previous palette layout. Good to know the palette itself works. I will look at the component list view issue later. I noticed that the Export function tells to have successfully exported, but actually it does nothing. I presume that this is because it's work in progress. It works here. I created the modern layout XML file using it. It uses the same code that writes the environment options XML file. It only saves a difference between user changes and the default settings. The export feature uses a standard file save dialog. Where did you save the file? .xml suffix may not be added automatically. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
Il 20/12/2014 23:44, Juha Manninen ha scritto: On Sat, Dec 20, 2014 at 9:17 PM, Giuliano Colla giuliano.co...@fastwebnet.it wrote: I spent some time testing, and here's my result. It would appear to be a Qt-only problem, but it seems to be a bit more intricate than just a redraw problem. ... Thanks for your testing. You have a lot more errors with QT than I do. Strange. May be difficult to fix if I cannot reproduce. The good news is that there is a workaround. You can restart Lazarus and the configuration works. It might be a timing issue. Sort of you tell Qt to do something on a new tab when it's not yet finished with the previous one. Actually the total number of tabs turns out to be less than expected. I've tested on a 32 bit dual core @1.33 GHz. I'm setting up a new platform 64 bit quad core @2.5 GHz. As soon as it's fully configured, I'll test there, and see if there's a difference. Or if you point me to the proper section of code, I may add some delay from one item to the next, just for testing. [...] I noticed that the Export function tells to have successfully exported, but actually it does nothing. I presume that this is because it's work in progress. It works here. I created the modern layout XML file using it. It uses the same code that writes the environment options XML file. It only saves a difference between user changes and the default settings. The export feature uses a standard file save dialog. Where did you save the file? .xml suffix may not be added automatically. No wonder it didn't work. I had attempted to save just the default setting. If it saves only the difference from default, it's got nothing to save! Giuliano -- Giuliano Colla Project planning question: when it's 90% done, are we halfway or not yet? -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
Did anybody manage to import this palette layout? I fixed the code already some time ago. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
On Thursday, December 18, 2014, Derit Agustin derit.agus...@gmail.com wrote: i found access violation in windows xp Right, it was caused by non-existent components because we have different set of packages installed. I have fixed it. There is also IPro page saved although it has no changes from the default. I must later find out why the configuration saves unchanged pages sometimes. It does not matter with the import feature now because possible non-existent components are skipped. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Alternative component palette layout
i found access violation in windows xp 2014-12-18 7:22 GMT+07.00, Juha Manninen juha.mannine...@gmail.com: If somebody wants to test my experimental alternative order for tabs and components in component palette, here is a config XML file attached. 1. Save the attached file somewhere. 2. Update to latest Lazarus trunk. 3. Tools - Options - Component palette - Import. Select the config file. 4. OK. Look at the component palette. Regards, Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus