Delphi 2006 refactoring keyboard mappings - delphi

How do I change the default refactoring keyboard mappings in Delphi 2006?

As you probably know, in D2006 you can find the settings under:
Tools > Options > Editor Options > Key Mappings
Also, there is the "Editor speedsetting" under:
Tools > Options > Editor Options
However, these don't give you direct control over the keymappings, they just let you choose a keymapping from among the installed Enhancement Modules. Per D2006 Help:
Enhancement modules
Enhancement modules are special packages that are installed and
registered and use the keyboard
binding features that can be developed
using the Open Tools API. You can
create enhancement modules that
contain new keystrokes or apply new
operations to existing keystrokes.
Once installed, the enhancement modules are displayed in the
Enhancement modules list box. Clicking
the check box next to the enhancement
module enables it and unchecking it
disables it. Key mapping defined in an
installed and enabled enhancement
module overrides any existing key
mapping defined for that key in the
key mapping module which is currently
in effect.
Clearly, this is not a quick do-it-yourself setting.
GExperts has a feature supporting IDE Menu Shortcuts that support hotkey configuration of any IDE menu command, including refactoring commands.

Related

How to change key mapping in Delphi 10.1 Berlin?

I want to change some shortcuts for speed settings in my processes. I know that there is an option to change it from Tools > Editor Options > Key Mappings menu but I want to re-assign some keys manually.
Is it possible to assign them from Delphi IDE directly without using any third party?
Just putting #Rudy Velthuis' comment as a answer:
Yes, you can remap keys, but only using a custom (partial) keybinding package, which you can easily write and install yourself. An example can be found on GitHub. You cannot, however, directly change key mappings "on the fly", unless you use a third party tool.

Update localized projects via console

I use Embarcadero C++ Builder to create application with different UI languages. Currently when original project is changing I need to manually select next options from IDE main menu:
Project → Languages → Update Localized Projects
Is it possible to make such action, i.e. update localized projects via console (without any GUI actions)?
Another way to update localized projects is to use External Translation Manager tool (included with RAD Studio). But this way also use GUI.
Additional information can be found on Embarcadero web page.

OK to use DCC_UsePackage in optset?

When you start using a package in a project you always have to change the same settings in the project options - search path, used run-time packages, unit aliasses, probably more. I'm currently trying to "outsource" all these settings for a certain library into an option set (*.optset). For search path and unit aliasses I could easily configure that using the XE6 IDE. But I didn't find an entry for run-time packages. So I manually added the relevant line
<DCC_UsePackage>MyPackage;$(DCC_UsePackage)</DCC_UsePackage>
to the optset file in a text editor and it seems to work. But I'm worried because the IDE doesn't support this. Is there a hidden gotcha?

Bug: Cannot edit hints/warnings in BPL project options

I took advantage of the (time limited) upgrade offer I received via email from Embarcadero and upgraded to Delphi XE7. I like it. Good versions like this appear ever 7 years :)
But I have a problem: I don't know how to silence some warnings. For example 'W1011 Text after final END'. The 'Project Options' box is different. All those editable values are gone. Instead I have 3 entries like 'Value from: Debug configuration - All platforms.'
Where I can configure the global "Debug configuration - All platforms" thing?
Edit: Updated after the screenshot. Old answer below labeled 'General projects' since it's still useful in the general case, for EXEs, DLLs, etc.
BPL projects in XE7 only (okay in XE6-, fixed in XE8+)
Update: this bug has been marked as resolved in XE8.
I see in your screenshot you have a BPL project open (btw, you're using the XE2 Graphics32 package in XE7 - better to use the dedicated XE7 one.)
I can verify that BPLs do not show the list of warnings and hints the way other project types do. EXEs, DLLs, etc list them, as below. I think this is a bug: RSP-8980. It is a regression from XE6; XE6 shows the hints and warnings as expected but XE7 does not.
Edit the DPROJ manually
David Heffernan points out that these options are supposed to be in the project, even though the UI isn't letting you edit them. One way would be to create another project (eg a DLL), set up the options as you need, and edit the BPL's project file (.dproj) manually to include them, copying from the correctly set up other project.
This is complicated - it's XML, you need to get all the named configurations exactly right, etc - but will mimic what the UI does for you.
BPK file
You can workaround this by specifying them in the .bpk file itself. You can see a number of project options are in the GR32 .bpk file:
The BPK is analogous to the DPR file, only for BPLs. To find this file, right-click the BPL project and click 'View Source'.
If you add the line
{$WARN GARBAGE OFF}
and rebuild (not recompile, but build) the project, you will see all units which previously showed warning W1011 now do not.
How do you know what a particular warning is called, when you have to refer to them by name not number? Look them up on this handy blog post.
I have added two Quality bug reports:
Allow hints and warnings to be referring to in compiler directives by number, not just name
Packages do not allow hints/warnings to be set in the Project Options the way other project types do
General projects
A project has a number of targets (such as Windows 32bit Debug, vs OSX 32bit Release, etc) and setting can be set for each of those. In addition, these settings are inheritable, so you can set settings for all debug targets, all release targets, etc.
In general, you should set a setting at the highest level possible, and override at the most specific level.
With that as background, to change W1011 Text after final end open the Project Options and navigate to the Hints and Warnings section. In the 'Target' dropdown combo at the top, choose the highest-level target where you want to make the change (for example, in this screenshot I've chosen 'Debug configuration - all platforms' which means that Win32 Debug and Win64 Debug and any other platform debug will use this setting with the value specified here.)
Expand the 'Output warnings' tree and ignore the dark red 'Value from Foo' nodes which are referring to the inherited values - it's impossible to use here and makes more sense for other settings. These are the ones that I think are confusing you, from your question. Instead, scroll down until you see 'Text after final end' (warnings are sorted alphabetically.)
Select it, and choose the option you're interested in.
Key things to avoid confusion:
Options are inherited
Use the combo box at the top to select the level at which you are applying the setting
Override at the most specific possible
Set at the most generic possible
When setting a value, ignore the dark red "Value from Foo" inherited nodes; just scroll down or expand, and set the setting you want

Delphi - locating path of a unit which the compiler can not search in its default path

I have downloaded a component that has many packages in it, then I have install all the design time packages and generated all the other dcu files.I have to assign its path in Delphi search path every time I create a new application. Is there a way to assign its path to Delphi compiler search path once and all application will get access to these unit, so that I need not to manually set every time the path for a new application.
If you want to have some component automatically available for every new projects you need to change the default Delphi IDE options - specifically path locations - so that Delphi IDE knows where to find needed files.
You do this by going into menu Tools -> Options. Then in the TreeView which is used for splitting the options into multiple categories you select Enviroment Options -> Delphi options -> Library.
On the right side of the window you will now have different options regarding the path locations for libraries and source files.
In order to allow Delphi to find needed precompiled units of your component you need to add the folder in which they are located to Library path.
In order to allow Delphi to find source files of your component you need to add the folder in which they are located to Browsing path.
You can read more information about these settings in the Delphi documentation which is also available online here:
http://docwiki.embarcadero.com/RADStudio/XE6/en/Library
Note if you don't own Delphi XE6 but one of the previous XE versions simply change the webpage URL by replacing "XE6" with the one you own.
EDIT: I have edited my answer to provide more specific information. Old post below:
If you got to Tools -> Options (or is it Enviroment Options in latest versions) you can set Default options for the Delphi IDE. These options also include the Default path settings which will be automatically used in all new projects.
The way I do this is to have a folder "Lib2" which I use as the unit output directory whenever I compile/install components - I let the components (I mean their source files, etc) be installed whereever they want).
(I call it "Lib2" because traditionally Delphi has placed its own DCUs in a folder called "Lib", and putting all the third-party ones in a folder separate from that one avoided having to re-install Delphi if my set-up got into a mess.)
If you do that, all you need do for new projects is to include the path to that folder in the project search path and set that as the default search path.
The way to do that varies with Delphi version - the D7 era it was just a question of ticking the "Default" checkbox on the Directories/Conditionals tab of Project | Options. The only minor problem is that sometimes the component needs a resource file; if the compiler complains about that, just copy it to there manually.
In XE4, there are several ways of getting Delphi to find compiled DCUs that you've send to Lib2 or whatever you care to call it:
The simplest seems to to do what the other answer suggests, namely add the Lib2 path to the list of Library paths under Tools | Options. The compiler will then use the DCUs it finds there without needing to be able to finds their sources, which is generally a good thing (see "btw" section below).
A second way is to create a project "Option Set" (see the OLH for details of what they are and how to create one, and then edit it (again, see OLH) to include Lib2 in the list of search paths. After that, you can apply that Option Set to any project which it suits. There may be a way to automatically apply your Option Set to new projects, but I haven't managed to find it yet. In any case ...
A third way is to add a project which has Lib2 amongst its search paths to the Delphi repository and then create new projects that you want to use Lib2's contents from this entry in the repository.
Btw, there is an important practical point to having 3rd party libraries and any of your own standard ones output their DCUs to your Lib2 or equivalent. Because the compiler can find the compiled DCUs there, it does not have to be able to find the source code of those libraries in order to be able to compile your project. Isolating the compiled DCUs in this way helps avoid the dreaded "unit x was compiled with a different version of y" error message (y usually being a bpl) which has been the cause of so many cries for help in Delphi newsgroups over the years.

Resources