I have posted my concept of a unified action system a while ago on the german user board. A translation has been requested.
I will add some more ideas from time to time. Your good ideas are welcome of course.
If you have questions don't hesitate to ask.
Unified command system
There is currently no unified system to manage commands in Total Commander. Commands are internal commands (cm_*) and user-defined commands. The current system works but it's quite difficult to handle. A redesign should be made. The following list compares the current and a possible new system.
The current system - Disadvantages of the current system:
- User defined commands depend on start menu entries.
- There is a hierarchy between menu hotkeys and user defined hotkeys.
- Hotkeys in menus are not updated automatically. You have to do this manually.
- Checkbox states in menus seems not to be part of an embedded system which enables automatic updating.
- Check states for buttons are completely missing.
- No separation between structure and language dependant information. This leads to redundancies and many other problems. Example: Exchanging of menu files doesn’t work very well. They contain language dependant captions and hotkeys.
- A single point of access (the command manager) is presented to the user.
- Commands are control independent. A command can be assigned to as many control as the user wants.
- Implementing a system based on the observer pattern will solve the updating problem for all checkboxes, captions and all other properties in all controls.
- Exchanging of user defined menus would be possible without or with much less translation.
For example when I create a hotkey for a start menu entry (Ctrl+Alt+F7) and use the same entry for a hotkey assignment in configuration the start menu entry has a higher priority.
A unified command system solves this problem. A user assigns a value to a command not to a control. This way hotkeys would be unique. Every time a user presses the hotkey the command is invoked. You may create a button, a menu item or whatever for the command but you don't have to if you just want a hotkey.
The command manager
I will add ideas and a prototype for a command manager here.
- The user can compose the current menu from a list of menus. For example. A user defined menu is appended to the default menu and so on.
Command properties
A command should have the following properties:
- Name - A unique name (identifier) for the command.
- Caption: A caption which is shown in a control where the action is used.
- Icon: A path to an icon.
- Hotkey(s): One or more hotkeys which can be used to call the command.
- Hint: A hint which can be shown to give more information about the action.
- Category: Each command is assigned to a category.
- Parameter: Some commands can have parameters.
- Start path: For some commands a start path is required.
- Window mode: For some commands a window mode makes sense (minimized, maximized, normal).
- Run As: Executing a command as a diffrent user (Yes/no).
Menu file. Example
Code: Select all
[CTG_MARK]
MENUITEM cm_spreadselection
MENUITEM cm_shrinkselection
[END_CTG]
Inside these markers we have the menu items. They just point to command identifiers. Language dependant captions and hotkeys are removed.
Predefined commands file. Example:
Code: Select all
[cm_SpreadSelection]
ID=521
Category=CTG_MARK
[cm_ShrinkSelection]
ID=522
Category=CTG_MARK
Categories in a menu or commands file can be the same but they don’t have to. It’s possible to add new categories in the menu file or use categories defined in the action file.
Userdefined command file. Example:
Code: Select all
[cm_CD_Pictures]
Category=CTG_NAVIGATION
Icon=%WINDIR%\System32\Shell32.dll,127
Please note that there is no ID set for the user defined command. Why? One aim of the unified command system is to make it easier to exchange user defined files like menu files, command files and others. Total Commander has to assign a ID dynamically for user defined commands. This has also the advantage that the user cannot assign an already assigned. This should be possible without huge speed problems.
Predefined Language file. Example:
Code: Select all
[CTG_MARK]
Caption=&Mark
Hint=Mark
[cm_SpreadSelection]
Caption=&Select group
Hint=Select group
Description= Selects a group of files and folders based on a filter.
Maybe the hotkey can be moved to the language file. Why? Maybe English users prefare Ctrl+Q for “quick view” and german users want to use Ctrl+ S (Schnellansicht). There are pros and cons for this and can be discussed endlessly.
Userdefined language file. Example:
Code: Select all
[cm_CD_Pictures]
Caption=&My Pictures
Hint=My Pictures
Description=