Jump to content

Anders Melander

Members
  • Content Count

    2946
  • Joined

  • Last visited

  • Days Won

    166

Everything posted by Anders Melander

  1. Anders Melander

    Better Translator Manager - Custom component

    I have attached an extraction of the BTM documentation I have. As I said it was written for use with a specific project (called FooBar in this version) and as such contains references to the setup of that project (folders, config files, etc.) and it assumed that the initial translation project file and update have already been done. The source document, as mentioned, comes from Confluence so the formatting of the exported document is a bit wacky, but I think it should be readable. Using_Better_Translation_Manager_-_Anders.Melander_-_Confluence_(2023-08-16_22_10_10).html
  2. Anders Melander

    Better Translator Manager - Custom component

    I have no idea what you are referring to.
  3. Anders Melander

    Better Translator Manager - Custom component

    Ah, that... Um... Eh... I don't really have anything besides what's on the Bitbucket page. Well, actually, now that I think of it I think I have something in a corporate Confluence page somewhere, but I will have to revise it for public consumption and it's probably targeted for use with a specific commercial project. I'll look into it later tonight.
  4. Anders Melander

    Better Translator Manager - Custom component

    Done. The new version is 2.0.8628.33873
  5. Anders Melander

    Better Translator Manager - Custom component

    What help is that? Yes, I see it. Apparently, the feature branch wasn't merged correctly. I'll get that fixed.
  6. Anders Melander

    User Drawing of Lines and Curves

    Convert the bezier to a polyline with a fixed limited number of points (whatever drawing routine you end up using already does this internally, you just need a lot fewer points for hit testing than for drawing a smooth line). Iterate the segments of the polyline and find the minimum distance from your point to the segments. Even with thousands of beziers, you should be able to do this in no time at all (I'm guessing low milliseconds).
  7. Anders Melander

    Better Translator Manager - Custom component

    Fixed. The purge was rejected unless the project contained obsolete items with translations. Get the new release (2.0.8628.30767) here: https://bitbucket.org/anders_melander/better-translation-manager/downloads/ Changes since the last release (2.0.8370.39904): Fix for unable to purge project unless it contains Unused translations. #43: Specify external PE resource module stub via command line #41: DeepL Integration Added Save As... action. Previously the Save action always prompted for filename.
  8. Anders Melander

    Better Translator Manager - Custom component

    Reproduced. I'll investigate now.
  9. Anders Melander

    Better Translator Manager - Custom component

    No, you're right; They cannot. Assuming this means that you cannot purge them, can you zip the translation project (just the xlat file) and post it as a DM to me.
  10. Anders Melander

    Better Translator Manager - Custom component

    That's "obsolete" items. Items that existed in a prior version of your application but which have been deleted since they were first imported. That usually happens when you delete components or units. You can't really hide them (that's a missing feature) but you can delete them: Or you can just mark them "Don't translate" and hide them that way. The reason they aren't just deleted automatically is that their translations (if they have any) can be reused by other items. For example, if you rename a component, then the translation-to-component link is broken but by comparing the source texts, BTM can move the link to the new component so the translation isn't lost. The Recover action does this. The translations of obsolete items are also still used as translation suggestions.
  11. Anders Melander

    Better Translator Manager - Custom component

    If you are not actually using that string anywhere then it's probably being eliminated by the linker. Resourcestrings are only ever loaded from STRINGTABLE resources and the STRINGTABLE resources (and the .drc file) are produced by the linker based on the units linked into the application. If you add a ShowMessage(aa) to the above example then I bet the resourcestring will appear. Regardless, I think we can conclude that this isn't a BTM problem.
  12. Anders Melander

    Better Translator Manager - Custom component

    Can you see the resourcestring in the .drc file? [edit] Btw, have you remembered to update the translation project after these changes? If you don't update the translation project it will only contain the strings that were in your project when you created the translation project.
  13. Anders Melander

    Better Translator Manager - Custom component

    That's the newest release; It's from December 2022. I don't know where you you got the year 2019 from. Nothing special needs to be done. If the resourcestring is implemented in unit XXX and you drop a component from XXX onto a form in unit YYY of project ZZZ, then the IDE will include unit XXX in unit YYY's uses clause and when you compile ZZZ, the resourcestring will appear in the ZZZ.drc file (it's a text file) located the sample place as ZZZ.exe. If you don't have ZZZ.drc then you need to configure your project to produce that file (see the project linker options) - but BTM should complain if it can't find the file.
  14. Anders Melander

    Better Translator Manager - Custom component

    All resourcestrings, regardless of the unit they come from, are listed under the Resourcestrings module node.
  15. Anders Melander

    Better Translator Manager - Custom component

    I'm still not sure what you're saying - or asking. You hide rows by filtering them out: Hover over the Status column header, click the button that appears in the header. Select the statuses that should be visible. Like in my screenshots. That's not really a question, but anyway: If your component strings appear in the string grid, then they can be translated; All resourcestrings and published component string (and string list) properties can be translated.
  16. Anders Melander

    Better Translator Manager - Custom component

    I'm not really sure if this is what you're asking for but you can indicate which modules to translate and which to ignore by right-clicking and changing their status: and then you can filter on the status: You can do the exact same in the string grid:
  17. I doubt that it's DevExpress that's slowing your project load down. I always have it installed and do not have any problems with it. It's more likely the livebindings design-time support that's the culprit (at least it used to be a common cause of slow downs). Try disabling the livebindings design time packages and see if that helps. The attached .reg file does that for Delphi 10.3, 10.4, and 11.x You may need to reinstall DevExpress afterward as I believe some of their packages have dependencies on the livebindings packages. disable delphi livebindings.reg
  18. Why would that make a difference? The whole directory/tree would need to be scanned anyway, even if he's only interested in the image files. [edit] Oh, I guess you mean select files based on the filename as opposed to the file content. I would probably go for an in-memory database (e.g. SQLite or even just a TFDMemTable) for the index but store the files on disk (but don't put all files in a single folder - that will suck). That said, if you have 50K files averaging 30Kb each, that's only 1,5 Gb total (+ overhead) so you could actually fit the whole thing in memory.
  19. Anders Melander

    TFruit class moved to component

    Ray Lischner. He wrote 3 Delphi books, AFAIR, none of them about component design. I've got "Delphi in a Nutshell" (basically just a reference book) and "Hidden Paths of Delphi 3" (about the old open tools API). Both had horrible binding and fell apart right away.
  20. Anders Melander

    Trap TFDConnection error on data module create etc?

    It was aimed at SQLite but it was not meant as a dis. As long as the limitations and risks are taken into account it's a fine embedded database engine. I haven't used it in a while but I have just read through the technical documentation and I can see that a lot has been done with regard to reliability since then. Still, after having read the docs I couldn't help but feel that there were problem areas that were brushed over or simply left out.
  21. Anders Melander

    Trap TFDConnection error on data module create etc?

    ...and the ability to not corrupt the database if the application crashes.
  22. Anders Melander

    TFruit class moved to component

    You (mostly) just need to derive your class from TComponent: type TFruit = class(TComponent) private FColor: string; protected public constructor Create(AOwner: TComponent); override; published property Color: string read FColor write FColor; end; ...and then you also need to register your component: procedure Register; begin RegisterComponents('Cool Stuff', [TFruit]); end; I suggest you read the documentation.
  23. Anders Melander

    [Delphi] Looking for a Delphi Profiler in 2023

    That isn't really a profiler.
  24. Anders Melander

    Trap TFDConnection error on data module create etc?

    Create the TFDConnection in code (e.g. in the DM constructor). Open the connection after the DM has been created. For complex applications, I use a design where the application startup is divided into stages. The stage progression is centrally controlled and broadcast to all interested parties. Something like this: // The following could be in the .dpr file type TRunStageBoot = bsInit..bsReady; TRunStageShutdown = bsShutdown..bsShutdown; begin // Broadcast startup progression for var Stage := Low(TRunStageBoot) to High(TRunStageBoot) do RunStageNotify(Stage); Application.Run; // Broadcast shutdown progression for var Stage := Low(TRunStageShutdown) to High(TRunStageShutdown) do RunStageNotify(Stage); end. ...and the run stage management: type TRunStage = ( bsInit, // Whatever needs to run before the DMs are created. E.g. load config. bsCreateModules, // Create DMs bsConnectDatabase, // Connect to database bsLoadDatabaseSchema, // Validate and update database schema bsLogin, // Perform application login bsInitUI, // Create main UI (e.g. mainform) bsReady, // Show UI bsShutdown // Application shutdown ); IRunStageSubscriber = interface {...GUID...} procedure RunStageNotify(Stage: TRunStage); end; TRunStageDelegate = reference to procedure(Stage: TRunStage); procedure RunStageNotify(Stage: TRunStage); procedure RegisterRunStageHandler(Delegate: TRunStageDelegate); overload; procedure RegisterRunStageHandler(const Subscriber: IRunStageSubscriber); overload; // ...similar for unsubscribe... implementation var // Create on demand in RegisterRunStageHandler. Free in finalization. RunStageSubscribers: TList<IRunStageSubscriber>; RunStageDelegates: TList<TRunStageDelegate>; procedure RegisterRunStageHandler(Delegate: TRunStageDelegate); begin RunStageDelegates.Add(Delegate); end; procedure RegisterRunStageHandler(const Subscriber: IRunStageSubscriber); begin RunStageSubscribers.Add(Subscriber); end; procedure RunStageNotify(Stage: TRunStage); begin for var Subscriber in RunStageSubscribers do Subscriber.RunStageNotify(Stage); for var Delegate in RunStageDelegates do Delegate(Stage); end; ... ...and the DM with the connection would then look something like this: type TDataModuleDatabase = class(TDataModule, IRunStageSubscriber) private FConnection: TFDConnection; private // IRunStageSubscriber procedure RunStageNotify(Stage: TRunStage); public constructor Create(AOwner: TComponent); override; end; var DataModuleDatabase: TDataModuleDatabase; implementation constructor TDataModuleDatabase.Create(AOwner: TComponent); begin inherited; FConnection := TFDConnection.Create(Self); // Setup params on connection ... // Register so we will be notified when the connection should be opened RegisterRunStageHandler(Self); end; procedure TDataModuleDatabase.RunStageNotify(Stage: TRunStage); begin case Stage of bsConnectDatabase: FConnection.Open; end; end; procedure RunStageNotify(Stage: TRunStage); begin case Stage of bsCreateModules: DataModuleDatabase := TDataModuleDatabase.Create(Application); end; end; initialization // Register so we will be notified when the DM should be created RegisterRunStageHandler(RunStageNotify); end;
  25. Anders Melander

    Profiler for Delphi

    Did you read the page linked to? First paragraph states: [edit] I guess you don't know what the PDB file is for. The PDB file is used by the profiler to map the addresses in the application being profiled to source files, function names, and line numbers. Without that information, the profiler would only be able to show you the raw addresses. Download and install VTune. Download map2pdb, extract the exe, and save it somewhere of your choice. For example c:\tools\map2pdb\map2pdb.exe Add a menu item in the Delphi IDE via Tools -> Configure Tools... The parameters in the above are: -debug -v -pause -bind:$EXENAME $PATH($EXENAME)$NAMEONLY($EXENAME).map -include:0001 Make sure the compiler are generating a full map file: Compile your project. Execute the map2pdb tool action. Launch VTune and create a profiler project for your exe. Profile the project in VTune. Profit!
×