From: Alex T. <al...@tw...> - 2004-07-08 23:17:46
|
I felt that using the Resource Editor wasn't quite as easy as it should be. No major problem, no big deal - but it just seemed like there was too much mouse usage, too many things to select, too much clicking, etc. (I use a laptop mostly, and so I'm perhaps more sensitive than I would be if I used a desktop and an actual mouse). I decided I'd have a go at modifying the Resource Editor, figuring that even if I didn't succeed, I'd at least learn some more about how to it's put together, and some new tips and tricks. I think I did that, but I chickened out of some of the more radical changes I thought of, because I wasn't ready to learn that much at one time. I decided that the things that most bothered me were - creating new menus; too much mouse clicking to position the new entries, and too much repetitive typing - adding new components you almost always change the name, then need to go re-select it, then scroll to the "label" or "text" property, then change it. - duplicating components - the default of small offset (10,10) is never what I want, and often confusing because it's right over the original. A detailed description of the changes follows. The code can be downloaded via www.tweedly.net/Python Changes made: 1. The menuEditor. 1.1 When you add a new Menu or new MenuItem, it is added immediately after (below) the current selection, instead of at the end of the list. So you don't need to repeatedly click "Up" to put each one into the place you want it. 1.2 When adding a new Menu, if you modify the Label value but not the Name value, the Menu is given a name derived from the Label's value. The derivation is simple (remove all punctuation including spaces). But since it is common practice to keep the Name and Label matching, this will be correct 99% of the time. 1.3 When adding a new MenuItem, the default name is calculated from the parent Menu (e.g. if the current selection is the File menu, or any item within it, then the name given will be "newFileNewItem"; the Label will be simply "New Item"). 1.4 If the Label value is edited, and the Name value is left unchanged, then the Name value will be derived from the Label. (e.g. if you change the Label from "New Item" to "&Close", the name will automatically change from "newFileNewItem" to "newFileClose". Remember - if you edit the Name field, it will no longer be automatically updated. 2. Creating a new component. Similar rules apply whether the component is created as a result of duplicating, or copy/pasting or directly adding a new component. (i.e. any of Edit/Duplicate Component, or by Copy/Paste, or by Component/<component>. A dialog is popped up, allowing the user to modify the Name and Label (or, if the component has no label, the Text) fields. I found that 99% of the time I change the Name, and maybe 80% of the time I change the Label/Text. So it's easier and faster to just fill in the dialog than it is to have the component be created with default values, then click around in the properties window to change them. I also added "horizontal" and "vertical" checkboxes. If these are checked, the new component will be offset in that dimension from the original (for duplication or pasting). If they are checked, the offset used is the size of the original component plus 30 pixels - so often the new position will be usable without further positioning. If neither is checked, then I default to the existing behaviour - i.e. offset by (10,10). I did have in mind some rules for deriving the name from the Label / Text, similar to what I did in the MenuEditor. But I couldn't decide just which rules to use - so I decided to implement this "partial" solution, and then get some experience with it before trying to decide which derivation rules to use. Installation instructions: 1. take a copy of the resourceEditor folder - call it myresourceEditor or similar 2. unzip the files 3. replace tools/myresourceEditor/resourceEditor.py 4. replace the menuDialog.py and menuDialog.rsrc.py in tools/myresourceEditor/modules 5. put the newcomponentDialog.py and newcomponentDialog.rsrc.py into tools/myresourceEditor/modules -- Alex. |