diff options
author | Piotr Strzelczyk <piotr@eps.gda.pl> | 2011-05-11 08:16:44 +0000 |
---|---|---|
committer | Piotr Strzelczyk <piotr@eps.gda.pl> | 2011-05-11 08:16:44 +0000 |
commit | f9f0c09fbf317d69c3001ad562b2eae14f0ebfb2 (patch) | |
tree | 09de76840390c5f6cb636dfd35e07f4f61d7ee20 /Build/source/texk | |
parent | fe36a4e41443a7a51139235fdba8858145e0aef2 (diff) |
rename to tl-tray-menu, add custom script
git-svn-id: svn://tug.org/texlive/trunk@22421 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r-- | Build/source/texk/texlive/w32_wrapper/tl-tray-menu.c (renamed from Build/source/texk/texlive/w32_wrapper/tl-menu.c) | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/Build/source/texk/texlive/w32_wrapper/tl-menu.c b/Build/source/texk/texlive/w32_wrapper/tl-tray-menu.c index 3e8474989d4..7aeef3e704d 100644 --- a/Build/source/texk/texlive/w32_wrapper/tl-menu.c +++ b/Build/source/texk/texlive/w32_wrapper/tl-tray-menu.c @@ -5,9 +5,9 @@ Simple tray menu Originally written in 2011 by Tomasz M. Trzeciak, Public Domain compiling with gcc (size optimized): -echo 1 ICON "tl-menu.ico">tl-menu.rc -windres tl-menu.rc tl-menu-rc.o -gcc -Os -s -mwindows -o tl-menu.exe tl-menu-rc.o tl-menu.c +echo 1 ICON "tl-tray-menu.ico">tl-tray-menu.rc +windres tl-tray-menu.rc tl-tray-menu-rc.o +gcc -Os -s -mwindows -o tl-tray-menu.exe tl-tray-menu-rc.o tl-tray-menu.c */ @@ -34,17 +34,19 @@ static char msgbuf[4*MAX_PATH]; #define MENU_TEXDOC 1 #define MENU_EDITOR 2 #define MENU_COMSPEC 3 -#define MENU_EXIT 69 +#define MENU_CUSTOM 4 +#define MENU_EXIT 42 HMENU hPopMenu; NOTIFYICONDATA nid; char szAppName[] = "TrayMenu"; -char ExeList[4][MAX_PATH] = { +char ExeList[5][MAX_PATH] = { "tlmgr-gui.exe", "texdoctk.exe", "texworks.exe", - "cmd.exe" + "cmd.exe", + "" }; LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) @@ -62,6 +64,8 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) AppendMenu( hPopMenu, MF_STRING, MENU_EDITOR, "&Editor (texworks)" ); if ( ExeList[MENU_COMSPEC][0] ) AppendMenu( hPopMenu, MF_STRING, MENU_COMSPEC, "&Command Prompt" ); + if ( ExeList[MENU_CUSTOM][0] ) + AppendMenu( hPopMenu, MF_STRING, MENU_CUSTOM, "Custom &Script" ); AppendMenu( hPopMenu, MF_SEPARATOR, 0, NULL ); AppendMenu( hPopMenu, MF_STRING, MENU_EXIT, "E&xit" ); } @@ -91,6 +95,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) case MENU_TEXDOC: case MENU_EDITOR: case MENU_COMSPEC: + case MENU_CUSTOM: if ( _spawnlp( _P_NOWAIT, ExeList[LOWORD(wParam)], NULL ) < 0 ) DIE( "Failed to start: %s", ExeList[LOWORD(wParam)] ); break; @@ -145,8 +150,14 @@ int APIENTRY WinMain( else ExeList[i][0] = '\0'; } + if ( s = getenv( "COMSPEC" ) ) strncpy( ExeList[3], s, MAX_PATH ); + strcpy( buffer, selfdir ); + strcat( buffer, "\\tl-tray-menu-custom.bat" ); + if ( GetFileAttributes( buffer ) != INVALID_FILE_ATTRIBUTES ) + strncpy( ExeList[4], buffer, MAX_PATH ); + // create a hidden window for messaging MSG msg; |