From: Alex T. <al...@tw...> - 2005-05-06 20:53:39
|
> Unfortunately, 0.3 will not be out tonight as previously expected. Version 0.3 is now available, at www.tweedly.net/Python/newresourceEditorv0.3.zip Note in particular the need to update Pythoncard/widget.py for this version. ---------------------------------------------------- Experimental Resource Editor v 0.3 This version of the resource Editor has the following changes: 0.2: as 0.1, with the addition of layering for multiple components, rectangular marquee selection and bug fixes - see "0.2" for details. 0.3: bug fixes: click-on-space deselects all components will now cause switch back to single mode ctrl-click to deselect component failed to remove said component from componentList display automatic naming rules - see below IMPORTANT NOTE: 0.3 requires you to update Pythoncard/widget.py When you unzip the newresourceEditorv0.3 directory, you will find the updated version of widget.py inside the resource editor directory. You need to copy this over to the top-level of your Pythoncard directory. Please keep a copy of the existing widget.py in case of problems. Property editor window display. The propertyEditor Window has been extensively changed. Previously it was a small window, showing a list of components and a list of attributes applicable to the currently selected component. The currently selected attribute was displayed (and editable) below this. The new version uses a much larger window, again showing a list of components. For the currently selected component, ALL attributes are shown, in a large area to the right. Any of the attributes can be edited directly, and the change will take effect as soon as the focus leaves the field being edited (the Update button is still also available). 0.3 Component naming when created - automatic naming rules When a component is newly created, its name is automatically generated; - if a new component being added, the name is formed by taking the component type name, and appending an integer - the smallest number which provides a new unique name. Thus: Button1, Button2, Button3, ... - if a component is being created by either a copy/paste, or Edit/Duplicate command, then name is based on the existing component, with an integer appended (again, smallest number to produce a new name is used). Thus: if Button1 is being Duplicated, the new component will be Button11, or Button12, or Button13.... If the component has a label or text attribute, this will be automatically generated; it will be the same as the name. Both the name and the label/text are marked as being "auto-generated" (actually, as NOT being "user-specified"). If either one is edited by the user, it is then marked as "user-specified", and it will no longer be subject to automatic updating. So long as the name or label/text are not user-specified, they will be automatically updated if the other one is modified by the user. The label/text will be set to the same as the name. The name will be set to the same as the label, but with all characters except letters and numbers removed, all spaces converted to underscore ("_"), and all other characters removed. Any leading numbers or underscores will be removed (to ensure it is a valid variable name), and it will be shortened to a maximum of 24 characters long. Then an integer will be appended, the smallest number producing a new unique name is used. In the propertyEditor display, alongside the name and label/text is a checkbox showing whether each is user-specified or not. If you modify, for instance, the name it will automatically check the associated checkbox. If you wish the name to revert to being automatically generated, simply uncheck this box. 0.3 end 0.2 section .... replaced by the above auto-naming rules In the existing resourceEditor, every time you create a component (either from the Component menu, or by Duplicate, or Paste), you are presented with a dialog box to specify the name (and label / text for those components that have them). I have taken that out (at least for now) - so the component is immediately created with the default name/label. I've found this better and faster for my testing - but I'm not sure if it would be the same when using the resourceEditor "for real", rather than for testing. If you want to revert to the earlier behaviour, find the line result = fakeEmptyDialog(desc, offsets, promptString) around line 1334. Comment it out, and reinstate the previous line. The medium-term intent is to extend the "clever default"s for deriving labels from names, or names from labels - so that you can achieve what you need with the minimum amount of typing possible. Stay tuned .... .... end of 0.2 section Multiple components. You can select multiple components and perform various operations on them. Clicking on a component selects it (just as before). Ctrl-click will add a component to the selected set, or remove it if it is already in there. The property window can be watched to let you know if you are in "single-component mode" or "multiple-component mode". If you select a number of components, and then deselect all but one of them, you remain in multi-component mode. (NB this feels better to me - but is certainly a candidate for later change if we think we should.) This does save a "flash" back into single mode display, when de-selecting and re-selecting most of a group. If there is NO component selected, and you select the first one by Ctrl-Click, then you enter multi-component mode immediately. The specific reason I did this no longer applies - but I'd got used to it by then. Again, this does save a certain amount of "flashing" between the two modes (and their display). Note that when in multiple-component mode, the component box in the property window is for display only - you cannot click in that box to (de)select components. "0.2" - fixed; in 0.1, it did allow clicking in this box, with varied and interesting results. A related fix involving selecting first component from this componentList in the propertyEditor, and additional components by Ctrl-clicking also fixed. It shows only those components which are in the selected set. This is mostly because Pythoncard doesn't have a multi-choice list box, but also partly because using a multi-choice list would make it harder to see at a glance which are selected. Once a set of components have been selected, you can mouse-down (i.e. press and hold, no ctrl-key) WITHIN one of the selected components; this will bring up the enclosing rectangle for the whole set, and you can then move them around. They can also be moved using the arrow keys; however, this has always been a bit flaky - sometimes the key events get captured by something else, and used for filed-traversal-tabbing. It may be a bit more flaky with the new display panel - see "nudge commands" below for other options. Note that Copy, Cut and Paste *do* work for multiple components. There isn't yet a Delete command that works for multiple-component mode, but you can simply Cut them in the meantime. 0.2 changes - marquee selection Multiple component selection using rectangular "marquee" You can select multiple components by enclosing them within a rectangular "marquee". The basic form involves pressing the mouse button down NOT within any component, and while holding the button down, dragging the mouse out to surround some components. These components will become a new multiple-component selection, replacing any previous selection. You can modify this by using modifier keys while doing the rectangle selection. 1. No modifier - define a new selection 2. shift-rectangle : add enclosed components to existing selection (any enclosed components already selected remain selected) 3. ctrl-rectangle : toggle the status of enclosed components (i.e. if already selected, remove it, if not already selected, add it) 4. shift-ctrl-rectangle : subtract from existing selection end of this 0.2 change. Buttons for layer changes. A component can be moved Back/Forward using the main menu Options / Send to Back, etc., or the shortcut keys Ctrl-1, Ctrl-2, etc. However, these keys don't work when focus is in the property window. Buttons have been added (below the component list box) to allow re-layering of a component. 0.2 changes : Relayering of multiple components. As well as the 4 buttons corresponding to the existing commands, there are two additional ones which only take effect when there are multiple components selected. First, a description of what it means to re-layer multiple components. All the selected components are put, in the order they were selected, together in the final order list. The base component (first one selected) is then moved back or forward according to the given command, with all other selected components following it. In some cases, you will want to collect the selected components together in the component ordering, but without changing the base component's place in the order. The first new button "gather together" does this. The second new button takes a set of components and re-layers them according to their position, in approximate "reading" order; top-left to bottom right, in rows. Just like "Gather together", this re-ordered set of components finish up adjacent in the layer ordering, following the place in order of the base component. Beware that the reading order works well if the components are non-overlapping, but can be hard to predict when there are multiple overlapping components selected (e.g. if you were to edit the resource editor's own resource file, where the "single-mode" and "multiple-mode" controls occupy the same area, and simply select all of them, you will get a different result from what you expect or want. This is a result of the comparison function used to sort into "reading order" - if one component is entirely below another, the order is clear; otherwise they are assumed to be on the same row, and sorted according to X coord. NB There is a definite lack of visual feedback from these commands. I'm trying to find a good way to give this feedback - any suggestions gratefully received. These command will probably go on the menu eventually. end of this 0.2 change Arrow keys & Buttons to 'nudge' components. The arrow keys can be used to reposition a component, as before. However, they now have the added feature that - Ctrl-arrow will move in that direction by the currently specified grid step, and align to the grid even if the "Align to grid" option is not enabled. - Shift-arrow will move by the grid step distance, but without rounding to the grid - Shift-Ctrl-arrow will move by the square of the grid size (and round to the basic grid). Good accelerator for big moves - beware you can jump right off the window if you're not careful. As mentioned above, occasionally (or perhaps often), one or more of the placed components gets in the way of key events ['buttons start tabbing, calendar starts moving the selected date, etc.]. Therefore there are now button on the property window to move the selected component or components. these are in the box labelled "NUDGE" at the bottom-left. Clicking on each arrow button here moves the component in the obvious direction. The number inside these buttons controls how far the components are moved; 1 moves by 1 pixel, 2 by a grid-step, 4 by the square of a grid-step. (3 is the same as 2 for now). These moves always honour the Align to Grid setting. [NB - this may change - either to be simply pixel distance, or a drop-down choice for the 1 vs grid vs grid*grid to allow all the choices available by the arrow keys.] Various operations are enabled when in multi-component mode. Remember that the *order* the components were selected (visible by order they are listed in the component box) is significant for many of these. Align operations. The box labelled "ALIGN" contains six buttons, which align the components up with the first selected on. They can be aligned by left side, right side, top, bottom (four buttons grouped to the left). Or the centres of the components can be aligned, either vertically or horizontally (i.e. into a column or into a row). Distribute operations. The box labelled "DISTRIBUTE" has four buttons; two on the left for distributing horizontally and two on the right for vertical distribution. The top button on each side distributes the components "edge-to-edge"; i.e. the first component does not move, the second one is placed to the left (or below) such that the edges line up, then the third, etc. The lower button distributes them with even-sized gaps from "first-to-last"; i.e. the first and last components do not move, the others are distributed between them such that the gaps between the edges are equal sized (or as close as possible). Note that if the components add up to larger than the total distance between first and last, then they will overlap (i.e. the 'gap' can be negative), but it will still be evenly shared between them. Equalize operations. The box labelled "EQUALIZE" has three buttons, which set the width (the height, or both) of all other components selected to match the first component. 0.2 changes : Bug fixes since 0.1 1. Never save sizing handles to resource file. In 0.1, if you selected multiple components, and then saved the resource file, the sizing handles were saved to the file along with the user's components. Oops. Fixed now. Other changes and bug-fixes included. 1. Flaky behaviour on re-sizing a component. Moving the cursor rapidly back inside a Textfield (or TextArea, or ...) while re-sizing it would cause it to change to almost random size. 2. Flaky "move" - double-click. Double-clicking within a Button component prior to moving it would cause the mouse to become "locked" into that component. So you could click outside the component, and it would nevertheless move with the mouse; also you were unable to select another component, or the menu. Could be solved by clicking in another window (though not another window of this program), and then clicking back in this window. I've got a "fix" for this in place - though I don't understand why it works. (I discovered that all subsequent mouse events were reporting the "getEventObject() wrongly, and having a handler for doubleClick - even one that does nothing - seems to solve it. You shouldn't - but might - see a dialog that says "You double-clicked - please don't" This means that work-around didn't work - just click OK to the dialog and you'll be able to continue. 3. Calendar component "hops" There is code to ensure that components with a border allow for that when calculating moves; without this a click on the component would "hop" it by the border width. This hadn't been done for Calendar components, and has now. [ Mac users - please let me know if I guessed right for the offset needed ] 4. Static line and gauges/sliders ignored layout setting. The setting for layout (either horizontal / vertical) was being ignored. Clearly still missing ..... 1. [DONE] re-layer for multiple components 2. delete multiple components (but Cut is done already) 3. [DONE] select multiple components by rectangular marquee 4. select multiple components by regular expression (useful if you use systematic names, and want to pick them all ....) 5. undo (at least for the multiple-component operations). Do be careful; you can mess up really fast with multiple component operations ! 6. Temporary hide/show of selected components. (Take a look at the property window in the resource editor - it's a pain to work on because the single-component mode fields overlap the multi-component mode buttons. -- Alex Tweedly http://www.tweedly.net -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.5 - Release Date: 04/05/2005 |