dummzeuch 1506 Posted August 20, 2022 @baka0815 I would like to discuss the patch for GExperts you put on SourceForge. I think this forum is better suited for that discussion than a bug report on SourceForge. For everybody else: The patch adds a menu item to the GExperts Favorite Files expert to import the favourites from the wuppdi welcome page. It does that by reading the ini file that wuppdi uses to store its configuration. The user has to select that file and after a confirmation the entries are imported and replace the current configuration. You requested feedback, so here we go (I'll start with some problems I found and will offer some suggestions) : Your patch did not compile with Delphi 2007 (and anything older) because scoped enums were introduced at some later time. That was easy to fix by simply removing the scope. After that change it compiled and worked It created a new menu item with an associated event rather than using an action as all the other menu items on that form do. I changed that. The file select dialog does not open to %appdata%\embarcadero\bds but only puts that into the filename edit. After pressing enter that directory was shown. In my opinion it should open to the directory that is used by wuppdi in the version of the IDE it runs on, for Delphi 10.2 that would be "%appdata\emvarcadero\bds\19.0", and it should preselect wuppdiwp.ini Overwriting the existing configuration might be fine for people who have used wuppdi and never used the GExperts Favorite Files expert. Others will probably not want to overwrite their configuration, so I think the import should offer to create a folder "wuppdi" with the new entries. If somebody continues to use wuppdi he probably doesn't want to import these entries every time he changes his favourites. Maybe having an option to automatically replace the GExperst favorites with the ones from wuppdi would be a good idea. Nobody wants to maintain such lists in parallel. Alternatively GExperts could add these favorites on the fly whenever the favorites menu is opened, again replacing the GExperts favorites or adding a folder "wuppdi" to the menu. An export to wuppdi might also be a nice feature, but I don't know when wuppdi reads and writes its .ini file so the data might be overwritten. As always I appreciate any contributions to GExperts. Share this post Link to post
baka0815 12 Posted August 22, 2022 Thanks for the feedback and sorry for opening the ticket as a "bug" instead of a "feature request"! Unfortunatly I don't have access to D2007 anymore. I only have an installation of 11 Alexandria available. I thought I considered all compatibility-problems and didn't use inline variables this time. 😉 The only scoped enum I used is "TMsgDlgType.mtWarning" right? Or did I miss another instance? I oversaw that and my version uses an action now as well. I would need two hints here: How should I open the file open dialog? There are only two overloads of ShowOpenDialog in GX_GenericUtils and both don't allow a directory as a parameter. Should I directly use a TOpenDialog dialog? Should I create an overload for ShowOpenDialog? How do I get the part of the path specific to the Delphi version? I couldn't find anything in the Embarcadero wiki to get the "19.0" for Delphi 10.2 or the "22.0" for 11.0. I was kinda confused at first when I wrote this import logic, because my settings were not saved. I imported the configuration file and the GUI displayed everything correctly but after a reload of Delphi all those settings were gone. That was the main reason I added the SaveEntries call at the end and the warning at the beginning. If I understand you correctly you would prefer if the import of the configuration file would not clear the root, but add a new subfolder called "wuppdi" (or similar)? As Daniel mentioned in the original wuppdi thread he does not plan to continue working on the wuppdi welcome page plugin, so I don't know if effort is necessary to sync the two files. The GExperts favourites have more options that the wuppdi wp as you can specify the "open mode" (IDE, custom, project, ...) and you can support an unlimited depth of subfolders which is both not supported by the wuppdi wp. It would be a hassle to sync the two files if one adds an entry from one of the two sides. I see this option more as a one-time conversion from wuppdi wp to GExperts favourites. This would surely be possible as an option, but won't work in all cases (especially in my case). I have Delphi 11 which is not supported by the wuppdi wp and so I don't have the configuration file in my BDS\11.0 folder. I would need to copy the old configuration file to the new directory to only use it with GExperts. So that doesn't seem viable to me. See my answers to 5 and 6. Attached is my current version of the patch with 1 and 2 addressed (hopefully). GX_FavFiles.pas.patch 1 Share this post Link to post
dummzeuch 1506 Posted August 27, 2022 (edited) On 8/22/2022 at 7:54 AM, baka0815 said: Attached is my current version of the patch with 1 and 2 addressed (hopefully). GX_FavFiles.pas.patch This patch was missing the changes to the .dfm file. On 8/22/2022 at 7:54 AM, baka0815 said: I would need two hints here: How should I open the file open dialog? There are only two overloads of ShowOpenDialog in GX_GenericUtils and both don't allow a directory as a parameter. Should I directly use a TOpenDialog dialog? Should I create an overload for ShowOpenDialog? How do I get the part of the path specific to the Delphi version? I couldn't find anything in the Embarcadero wiki to get the "19.0" for Delphi 10.2 or the "22.0" for 11.0. GX_GenericUtils.GetUserApplicationDataFolder can replace the %appdata% environment variable which is what causes the dialog to fail showing the correct directory. As far as I am aware there is no official way to get that number. GExperts declares some constants depending on the VERnnn symbols in GX_VerDepConst. The public documents subdirectory is not one of them, but you could easily add a constant for that. since the required number is already part of the CompilerDefinedProductRegistryKey. Please remember that Wuppdi was only available for some Delphi versions (I don't really known which ones), so that option doesn't make sense for e.g. Delphi 6. On 8/22/2022 at 7:54 AM, baka0815 said: I was kinda confused at first when I wrote this import logic, because my settings were not saved. I imported the configuration file and the GUI displayed everything correctly but after a reload of Delphi all those settings were gone. That was the main reason I added the SaveEntries call at the end and the warning at the beginning. If I understand you correctly you would prefer if the import of the configuration file would not clear the root, but add a new subfolder called "wuppdi" (or similar)? Yes. I would implement it this way: Instead of showing the file select dialog show your own dialog. It gives the path of the wuppdi ini file in an edit field (you know the path and filename, so you can check whether it exists and display an error if it doesn't). This edit should allow drag and drop (TWinControl_ActivateDropFiles) and autocompletion (TEdit_SetAutocomplete) and offer a ... button to let the user select the file. A second edit field allows entering the name of a subfolder to import into. Edited August 27, 2022 by dummzeuch Share this post Link to post
baka0815 12 Posted August 31, 2022 Ok, I hope I addressed all issues. I created a new form to select the WuppdiWP configuration file as well as a subfolder. The default is "WuppdiWP" and an empty subfolder means "overwrite existing favorites". The user get's an appropriate message. Otherwise the new subfolder is created and the the configuration file is read into that. I didn't touch any of the project files as I only have Delphi 11 and I didn't want to break any existing project files and was unsure adding the new unit with a text editor or similar. I can still do that if you want. But it was enough of a hassle to create the new form completely in Notepad++ to not include some Delphi 11 specialities. FavoriteFiles.patch 1 Share this post Link to post
dummzeuch 1506 Posted August 31, 2022 I like this a lot better but there seems to be one major problem: After importing the Wuppdi entries, it's impossible to delete the created folder. I get the error "You cannot delete the root folder, please select a different folder." I guess that's not too difficult to fix. I'll look into that later. A few things were not quite to my taste with the new dialog: It is not resizable The labels were to the left of the edit fields rather than above (which makes a possible future translation more difficult as that changes the size of the labels - but translation is not going to happen anyway). Due to 1 and 2 the input field for the filename is very small. The dialog opens centered on the monitor rather than the form There was a property and corresponding field for a reference to the Favorite Files dialog which wasn't used anywhere. I fixed these issues and once I fixed the problem with the root folder error message and did some additional tests, I'll commit it to the repository. Thanks again for your contribution. Share this post Link to post
baka0815 12 Posted August 31, 2022 Hmm, I need to look into that. I thought I fixed that, as the "WuppdiWP"-subfolder is now below the "Favorites" folder (it was a sibling before). But it looks like I messed something up, as it's still a sibling... Ah, I need to call AddChildObject instead of AddObject - that fixes the issue (btw. restarting Delphi also fixes this as a sibling to Favorites is unsupported). I can change that. How should the fields behave? Should I anchor them left, top and right? I used the "folder properties" dialog as a starting point and there the labels are in front of the edit fields. The same for the file properties. So I would leave it like that. see above This is also the same for folder and file properties. Which property? Share this post Link to post
dummzeuch 1506 Posted August 31, 2022 1 minute ago, baka0815 said: Hmm, I need to look into that. I thought I fixed that, as the "WuppdiWP"-subfolder is now below the "Favorites" folder (it was a sibling before). But it looks like I messed something up, as it's still a sibling... Ah, I need to call AddChildObject instead of AddObject - that fixes the issue (btw. restarting Delphi also fixes this as a sibling to Favorites is unsupported). I can change that. How should the fields behave? Should I anchor them left, top and right? I used the "folder properties" dialog as a starting point and there the labels are in front of the edit fields. The same for the file properties. So I would leave it like that. see above This is also the same for folder and file properties. Which property No need to fix the dialog, I already did that. Yes, the other forms work differently and should possibly be changed as well. re 5.: FavoriteFilesForm As for the root folder error: After looking at the code for switching to a different file, I think the easiest fix is to clear the tree view and call CreateFolders. But I'm not yet sure. I don't know this code well enough. Share this post Link to post
baka0815 12 Posted August 31, 2022 See my comment above. I used "AddObject": FavNode := tvFolders.Items.AddObject(tvFolders.Items.GetFirstNode, FavSubfolder, BaseFolder); but it should be "AddChildObject": FavNode := tvFolders.Items.AddChildObject(tvFolders.Items.GetFirstNode, FavSubfolder, BaseFolder); AddObject wants a "sibling" as the first parameter where AddChildObject wants the parent. And we want to use the parent here. Share this post Link to post
dummzeuch 1506 Posted August 31, 2022 Apart from restarting the IDE, File -> Favorite File Collection -> Open Default Collection also works. Yes, calling AddChildObject fixes the problem. Sorry, I missed that. 1 Share this post Link to post
dummzeuch 1506 Posted August 31, 2022 (edited) committed to revision #3869 Edited August 31, 2022 by dummzeuch 1 Share this post Link to post