• R/O
  • SSH
  • HTTPS

cadencii: コミット


コミットメタ情報

リビジョン1814 (tree)
日時2011-11-26 16:27:11
作者kbinani

ログメッセージ

[luavsq] 呼び出すWinAPIを間違えていたのを修正

変更サマリ

差分

--- luavsq/trunk/JobPlugins/GetOpenFileName.c (revision 1813)
+++ luavsq/trunk/JobPlugins/GetOpenFileName.c (nonexistent)
@@ -1,43 +0,0 @@
1-#include <lua.h>
2-#include <lualib.h>
3-#include <lauxlib.h>
4-#include <windows.h>
5-#include <tchar.h>
6-
7-int luavsq_GetOpenFileName( lua_State *L )
8-{
9- int n = lua_gettop( L );
10-
11- if( n == 1 ){
12- const char *path = lua_tostring( L, 1 );
13-
14- TCHAR fileNameFull[MAX_PATH] = "";
15- TCHAR fileName[MAX_PATH] = "";
16-
17- HWND processDialog = FindWindow( NULL, "Running Job Plugin ..." );
18-
19- OPENFILENAME arg;
20- ZeroMemory( &arg, sizeof( arg ) );
21- arg.lStructSize = sizeof( arg );
22- arg.hwndOwner = processDialog;
23- arg.lpstrFilter = _T( "VOCALOID2 Sequence (*.vsq)\0*.vsq\0All Files (*.*)\0*.*\0\0" );
24- arg.lpstrFile = fileNameFull;
25- arg.lpstrFileTitle = fileName;
26- arg.nMaxFile = sizeof( fileNameFull );
27- arg.nMaxFileTitle = sizeof( fileName );
28- arg.Flags = OFN_OVERWRITEPROMPT;
29- arg.lpstrTitle = _T( "Export VOCALOID2 Sequence" );
30- arg.lpstrDefExt = _T( "vsq" );
31-
32- if( GetOpenFileName( &arg ) ){
33- lua_pushstring( L, (const char*)fileNameFull );
34- }else{
35- lua_pushnil( L );
36- }
37-
38- return 1;
39- }else{
40- lua_pushnil( L );
41- return 1;
42- }
43-}
--- luavsq/trunk/JobPlugins/GetSaveFileName.c (nonexistent)
+++ luavsq/trunk/JobPlugins/GetSaveFileName.c (revision 1814)
@@ -0,0 +1,78 @@
1+/**
2+ * GetSaveFileName.c
3+ * Copyright © 2011 kbinani
4+ *
5+ * This file is part of ExportVSQ.
6+ *
7+ * ExportVSQ is free software; you can redistribute it and/or
8+ * modify it under the terms of the BSD License.
9+ *
10+ * ExportVSQ is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13+ */
14+#include <lua.h>
15+#include <lualib.h>
16+#include <lauxlib.h>
17+#include <windows.h>
18+#include <tchar.h>
19+
20+/**
21+ * 「ファイル名を付けて保存」ダイアログボックスを開き、ダイアログで指定されたファイル名を取得する。
22+ * VOCALOID3 Editor が JobPlugin 起動時に表示する "Running Job Plugin ..." というタイトルのウィンドウを
23+ * 検索し、そのウィンドウに対してモーダルにダイアログボックスを開こうとする
24+ *
25+ * @usage Lua スクリプトからは、以下のように使用する
26+ * <code>
27+ * local luavsq_GetSaveFileName = package.loadlib( "GetSaveFileName.dll", "luavsq_GetSaveFileName" );
28+ * if( nil == luavsq_GetSaveFileName )then
29+ * assert( false, "DLL のロードエラー" );
30+ * end
31+ * local path, message = luavsq_GetSaveFileName( "" );
32+ * if( nil == path )then
33+ * assert( false, "DLL の実行時エラー; エラーメッセージ: " .. message );
34+ * else
35+ * print( "指定されたファイルパス: " .. path );
36+ * end
37+ * </code>
38+ */
39+int luavsq_GetSaveFileName( lua_State *state )
40+{
41+ int n = lua_gettop( state );
42+
43+ if( n == 1 ){
44+ const char *path = lua_tostring( state, 1 );
45+
46+ TCHAR fileNameFull[MAX_PATH] = "";
47+ TCHAR fileName[MAX_PATH] = "";
48+
49+ HWND progressDialog = FindWindow( NULL, "Running Job Plugin ..." );
50+
51+ OPENFILENAME arg;
52+ ZeroMemory( &arg, sizeof( arg ) );
53+ arg.lStructSize = sizeof( arg );
54+ arg.hwndOwner = progressDialog;
55+ arg.lpstrFilter = _T( "VOCALOID2 Sequence (*.vsq)\0*.vsq\0All Files (*.*)\0*.*\0\0" );
56+ arg.lpstrFile = fileNameFull;
57+ arg.lpstrFileTitle = fileName;
58+ arg.nMaxFile = sizeof( fileNameFull );
59+ arg.nMaxFileTitle = sizeof( fileName );
60+ arg.Flags = OFN_OVERWRITEPROMPT;
61+ arg.lpstrTitle = _T( "Export VOCALOID2 Sequence" );
62+ arg.lpstrDefExt = _T( "vsq" );
63+
64+ if( GetSaveFileName( &arg ) ){
65+ lua_pushstring( state, arg.lpstrFile );
66+ lua_pushstring( state, "Succeeded." );
67+ }else{
68+ lua_pushnil( state );
69+ lua_pushstring( state, "GetSaveFileName WinAPI call return FALSE." );
70+ }
71+
72+ }else{
73+ lua_pushnil( state );
74+ lua_pushstring( state, "Invalid number of argument(s)." );
75+ }
76+
77+ return 2;
78+}
旧リポジトリブラウザで表示