I'm sorry my english is bad. how to add a shorcut at toolbar in lyx?? so that If I klick the shorcut, I can connect to the TortoiseSVN, just shorcut(seemlessly) thanks.
This turns out not to be straight-forward at all. You need to do two things: create a new LyX command, and then create new menu item where you want it to appear.
First, some pointers:
LyX user interface and command files are stored in the
commands directories in:
These settings are per-user, and it's generally not recommended to mess with the global settings. For reference, the equivalent global settings directories are in:
/usr/share/lyxon Linux (might be different depending on your distribution)
What you need to do:
Define a new command in your per-user
commandsdirectory in a file
default.def(create it if it doesn't exist, including the
commandsdirectory). Your command will look something like:
\define "my-command" "vc-command <flags> \"path-to-command\" \"command-to-run\""
Note that you need to escape double quotes within the command definition as they delimit LyX commands and their arguments.
<flags>can be one or more of
UDIRM(no flags, need loaded document, mark document "dirty", reload after execution, ask for user input). Combine as needed.
path-to-commandyou might use
$$pto denote the current document path, and in
command-to-runyou can additionally use
$$mwhich will be substituted with the current document or message, respectively. For the full syntax, you might want to look at
docdirectory in your installation, or choose Help->LyX functions from the program itself.
In your case, you will probably have something like:
\define "svn-commit" "vc-command D \"path-to-svn.exe\" \"svn commit %%i\""
With the command done, you will need to create a menu item for it in the interface. You can choose between menu items, toolbar items and context menus. Full treatment of the syntax will take a lot of space here, so I defer you to take a look at
stdcontext.incto see how the syntax looks like. Something that should work for you:
- Copy the
default.uifile from the global
uidirectory to the local one.
- Create a new "mymenu.ui
file in the localui` directory. In it, you'll have something like: Toolbar "my-toolbar" "My toolbar" Item "SVN Commit" "svn-commit" ... End
Check one of the
stdtoolbars.incfile in the global
uidirectory to see how the syntax looks like.
Edit your local
default.uiand add the following line below the other includes:
Further down, add your toolbar in the
Toolbarssection somewhere. The file has in-line instructions for some appearance options.
- Copy the
Now, you are ready to start LyX. Do so, and notice there are no changes in the appearance. Not to worry -- you need to tell LyX to use your own customized UI file instead of the standard one. The user interface selection is naturally under Look & Feel->User Interface in LyX preferences. Choose your new file, restart LyX, and keep your fingers crossed.
More things to do:
- You might also want to assign a keyboard shortcut to your custom commands, and you can do so in LyX preferences, under Editing->Shortcuts.
At this point you are probably discouraged enough and decided this is not worth the hassle. I'm tempted to agree with you, and found that a handy opened command line window / Unix shell is far more convenient than messing with UI configuration files.