ddahlstrom Posted November 26, 2009 Posted November 26, 2009 (edited) Note that this post has been superceded by this one http://forums.eagle.ru/showpost.php?p=795212&postcount=117 Given my general aversion to editing xml files :cry:, I've tacked on a new feature to TouchPal that will permit changing button and light controls directly in the GUI. To use this feature, build TouchPal with the attached source code changes (further instructions below), then run TouchPal with the -design command line option. Note that this command line option may be left on permanently if you like as it should not interfere with normal runtime operations. Changing a control To change a button (or light), simply right-click on it in the GUI. This will bring up a small context menu with a combobox and two buttons (Accept and Cancel). The combobox contains a list of all available controls that are the same size as the one you right clicked on. To replace the control, simply select an alternate one from the list and press the Accept button. You may undo your changes by pressing the blue Undo button that will appear near the bottom left of the screen after you've done an edit. Saving your changes Once you've changed one or more controls, a Save button will appear in the lower left area of the screen. Click on the button once to save your changes permanently to the touchpal.xml file. Important note: It is recommended to backup your original touchpal.xml file before saving. Also be aware that all comments in the touchpal.xml file will be stripped out when saving. Usage Notes 1. Most controls have a graphic assigned to them. When they do, you will see icons next to them in the context menu list. Some controls, however, are really just areas on a background template (like the ABRIS buttons). These will not be displayed with an icon and you will not be able to change the graphic, although you can still change its assignment. 2. For convenience, controls that are defined but not currently assigned to a panel, will show up on the list in slightly dimmed italics. You can select these just like any other control. 3. In the course of changing buttons, it is likely that you will temporarily produce duplicate buttons on screen. If you've just changed a button assignment and would like to see if there is a duplicate on screen, simply press the button and watch. You should see any duplicates also being depressed (this doesn't work for controls that don't change visible state when clicked). 4. It is important to note that this feature is not a profile *creation* tool, but a profile *modification* tool. It presumes you already have a fully populated and basically correct profile installed that you want to tweak. If you want to create brand new controls, graphics, or layouts, you will still need to hand-edit the profile. Source Code This post only includes source code. I will let Gadroc inspect to see if he would like to merge it into the project. Assuming the source tip over at Google hasn't changed in the last couple of days, you should be able to use the files in the attached zip pretty much as-is. Just drop in and replace. Note, however, that I haven't included a new project file, so you will need to add the following class files to the project manually using the Add Existing Item option in VS (assuming you're using VS). * ProfileManager.cs, * CockpitContextMenu.cs, * SaveAction.cs * UndoAction.cs * UndoEditItem.cs * UndoEditStack.cs * RoundStack.cs Also be aware that there is a slightly modified replacement touchpal.xml file included that is needed to support the new Save and Undo button panels; and you will also need to add the following graphics to your blackshark folder. * save.png * undo.png * power.png (optional -- to match look of new save & undo buttons) Oh yeah, some friendly reminders: Don't forget to add -debug to the command line arguments in the Debug tab of the project if you are using the debugger (or to the executable if you're running it that way). Also don't forget to adjust the <Layout> X and Y coordinates in touchpal.xml if you have customized them and are replacing your existing file with this one. Dave TouchPalEditor.zip Edited December 6, 2009 by ddahlstrom 1
Recommended Posts