unit my_settingfile; //{$DEFINE DEBUG} {$DEFINE LARGE_BUG} interface uses Windows; const //仮想キーコード VK_0 = Ord('0'); VK_1 = Ord('1'); VK_2 = Ord('2'); VK_3 = Ord('3'); VK_4 = Ord('4'); VK_5 = Ord('5'); VK_6 = Ord('6'); VK_7 = Ord('7'); VK_8 = Ord('8'); VK_9 = Ord('9'); VK_A = Ord('A'); VK_B = Ord('B'); VK_C = Ord('C'); VK_D = Ord('D'); VK_E = Ord('E'); VK_F = Ord('F'); VK_G = Ord('G'); VK_H = Ord('H'); VK_I = Ord('I'); VK_J = Ord('J'); VK_K = Ord('K'); VK_L = Ord('L'); VK_M = Ord('M'); VK_N = Ord('N'); VK_O = Ord('O'); VK_P = Ord('P'); VK_Q = Ord('Q'); VK_R = Ord('R'); VK_S = Ord('S'); VK_T = Ord('T'); VK_U = Ord('U'); VK_V = Ord('V'); VK_W = Ord('W'); VK_X = Ord('X'); VK_Y = Ord('Y'); VK_Z = Ord('Z'); { const //キー、表示用 G_csCustomShortCut_DispKeySpace = 'スペース'; G_csCustomShortCut_DispKeyEnter = 'Enter'; G_csCustomShortCut_DispKeyBkSp = 'BS(後退)'; G_csCustomShortCut_DispKeyDel = 'Del'; G_csCustomShortCut_DispKeyIns = 'Ins'; G_csCustomShortCut_DispKeyEsc = 'Esc'; G_csCustomShortCut_DispKeyPgUp = 'PgUp'; G_csCustomShortCut_DispKeyPgDn = 'PgDn'; G_csCustomShortCut_DispKeyHome = 'Home'; G_csCustomShortCut_DispKeyEnd = 'End'; G_csCustomShortCut_DispKeyUp = '↑'; G_csCustomShortCut_DispKeyDonw = '↓'; G_csCustomShortCut_DispKeyLeft = '←'; G_csCustomShortCut_DispKeyRight = '→'; //マウスジェスチャ、表示用 G_csCustomShortCut_DispGestureUp = 'ジェスチャ ↑'; G_csCustomShortCut_DispGestureDonw = 'ジェスチャ ↓'; G_csCustomShortCut_DispGestureLeft = 'ジェスチャ ←'; G_csCustomShortCut_DispGestureRight = 'ジェスチャ →'; } const { メニューコマンド 項目の増減はOKだが値の変更はNG。 変更した場合は設定ファイルの互換性が無くなる。 項目を増やす場合はユニークな値をセットする。 項目を減らす場合割り当てられていた値の使い回しはNG。 重複を避けるため項目を減らす場合はその項目を削除するのではなくコメントアウトにし 残しておきその値は使わないようにするのが吉。 並べ替えの場合も元の位置にはコメントアウトとしてそのまま残しておくのが間違いを防 ぐ意味で吉。 } //[ズーム] G_ciIDMZOOM = 1000; G_ciIDMZOOM_1 = 1001; G_ciIDMZOOM_2 = 1002; G_ciIDMZOOM_3 = 1003; G_ciIDMZOOM_4 = 1004; G_ciIDMZOOM_6 = 1006; G_ciIDMZOOM_8 = 1008; G_ciIDMZOOM_10 = 1010; G_ciIDMZOOM_12 = 1012; G_ciIDMZOOM_16 = 1016; G_ciIDMZOOM_20 = 1020; //[グリッド] G_ciIDMGRID = 2000; G_ciIDMGRID_DISP = 2001; G_ciIDMGRID_LINEGRID = 2002; G_ciIDMGRID_GRAY = 2003; G_ciIDMGRID_BLACK = 2004; G_ciIDMGRID_WITE = 2005; G_ciIDMGRID_INVERT = 2006; G_ciIDMGRID_TRANSPARENT = 2007; G_ciIDMGRID_SELCOLOR = 2008; G_ciIDMGRID_LINESUBGRID = 2009; G_ciIDMGRID_SUBNONE = 2010; G_ciIDMGRID_SUBBLUE = 2011; G_ciIDMGRID_SUBRED = 2012; G_ciIDMGRID_SELSUBCOLOR = 2013; G_ciIDMGRID_LINESUBGRID2 = 2014; G_ciIDMGRID_SUBELSECOLOR = 2015; G_ciIDMGRID_SELSUBELSECOLOR = 2016; //[-] G_ciIDMMAIN_LINE1 = 1; //[カラー情報] G_ciIDMCOLOR = 3000; G_ciIDMCOLOR_RGB = 3001; G_ciIDMCOLOR_HTML = 3002; G_ciIDMCOLOR_COLORREF = 3003; G_ciIDMCOLOR_HSV = 3004; G_ciIDMCOLOR_HLS = 3005; G_ciIDMCOLOR_HLSWIN = 3006; G_ciIDMCOLOR_LINE1 = 3007; G_ciIDMCOLOR_INFOONOFF = 3099; //[カーソル位置] G_ciIDMPOS = 4000; G_ciIDMPOS_SCREEN = 4001; G_ciIDMPOS_MONITOR = 4002; G_ciIDMPOS_CLIENT = 4003; G_ciIDMPOS_USER = 4004; G_ciIDMPOS_LINE1 = 4005; G_ciIDMPOS_INFOONOFF = 4099; //[ウィンドウ情報] G_ciIDMWININFO = 5000; G_ciIDMWININFO_HANDLE = 5001; G_ciIDMWININFO_CLASSNAME = 5002; G_ciIDMWININFO_TEXT = 5003; G_ciIDMWININFO_WINDOWSIZE = 5004; G_ciIDMWININFO_CLIENTSIZE = 5005; G_ciIDMWININFO_RECT = 5006; G_ciIDMWININFO_CONTROLID = 5007; G_ciIDMWININFO_STYLE = 5008; G_ciIDMWININFO_PARENTWINDOW = 5009; G_ciIDMWININFO_PID = 5010; G_ciIDMWININFO_EXENAME = 5011; G_ciIDMWININFO_FILEVERSION = 5012; G_ciIDMWININFO_LINE1 = 5013; G_ciIDMWININFO_STYLEVERBOSE = 5014; G_ciIDMWININFO_STYLEFOLLOWMAIN = 5015; G_ciIDMWININFO_LINE2 = 5016; G_ciIDMWININFO_INFOONOFF = 5099; //[-] G_ciIDMMAIN_LINE2 = 2; //[コピー] G_ciIDMCOPY = 6000; G_ciIDMCOPY_PICTURE = 6001; G_ciIDMCOPY_LINE1 = 6002; G_ciIDMCOPY_COLORRGB = 6003; G_ciIDMCOPY_COLORRGBRED = 6004; G_ciIDMCOPY_COLORRGBGREEN = 6005; G_ciIDMCOPY_COLORRGBBLUE = 6006; G_ciIDMCOPY_COLORHTML = 6007; G_ciIDMCOPY_COLORCOLORREF = 6008; G_ciIDMCOPY_COLORHSV = 6009; G_ciIDMCOPY_COLORHLS = 6010; G_ciIDMCOPY_COLORHLSWIN = 6011; G_ciIDMCOPY_LINE2 = 6012; G_ciIDMCOPY_POSSCREEN = 6013; G_ciIDMCOPY_POSMONITOR = 6014; G_ciIDMCOPY_POSCLIENT = 6015; G_ciIDMCOPY_POSUSER = 6016; G_ciIDMCOPY_LINE3 = 6017; G_ciIDMCOPY_WININFOHANDLE = 6018; G_ciIDMCOPY_WININFOCLASSNAME = 6019; G_ciIDMCOPY_WININFOTEXT = 6020; G_ciIDMCOPY_WININFOWINDOWSIZE = 6021; G_ciIDMCOPY_WININFOCLIENTSIZE = 6022; G_ciIDMCOPY_WININFORECT = 6023; G_ciIDMCOPY_WININFOCONTROLID = 6024; G_ciIDMCOPY_WININFOSTYLE = 6025; G_ciIDMCOPY_WININFOSTYLEEX = 6026; G_ciIDMCOPY_WININFOPID = 6027; G_ciIDMCOPY_WININFOEXENAME = 6028; G_ciIDMCOPY_WININFOFILEVERSION = 6029; G_ciIDMCOPY_WININFOSTYLEVERBOSE = 6030; G_ciIDMCOPY_LINE4 = 6031; G_ciIDMCOPY_ALL = 6099; //[キャプチャ] G_ciIDMCAPTURE = 7000; G_ciIDMCAPTURE_PAUSE = 7001; G_ciIDMCAPTURE_LINE1 = 7002; G_ciIDMCAPTURE_LUPE = 7003; G_ciIDMCAPTURE_FIXED = 7004; G_ciIDMCAPTURE_LINE2 = 7005; G_ciIDMCAPTURE_UPDATE = 7006; //[設定] G_ciIDMCUSTOMIZE = 8000; G_ciIDMOPT_STAYONTOP = 8001; G_ciIDMOPT_TITLEBAR = 8002; G_ciIDMOPT_TOOLBAR = 8003; G_ciIDMOPT_FONTSIZE = 8004; G_ciIDMOPT_NOSELFCAPTURE = 8005; G_ciIDMOPT_SMOOTHCAPTURE = 8006; G_ciIDMOPT_LINE2 = 8007; //[カスタマイズ] G_ciIDMCUSTOMIZE_SETTING = 9000; G_ciIDMCUSTOMIZE_MENU = 9001; G_ciIDMCUSTOMIZE_TOOLBAR = 9002; G_ciIDMCUSTOMIZE_SHORTCUT = 9003; G_ciIDMCUSTOMIZE_COPY = 9004; //[-] G_ciIDMMAIN_LINE3 = 3; //[バージョン情報] G_ciIDMHELP = 13001; //[最小化] G_ciIDMFILE_MINIMIZE = 12001; //[-] G_ciIDMMAIN_LINE4 = 4; //[終了] G_ciIDMFILE_EXIT = 12002; const { コマンド(アクション)識別用のユニークな番号。 項目の増減はOKだが値の変更はNG。 変更した場合は設定ファイルの互換性が無くなる。 項目を増やす場合はユニークな値をセットする。 項目を減らした場合割り当てられていた値の使い回しはNG。 } //[Zoom] 10 G_ciCMDZOOM_1 = 1001; G_ciCMDZOOM_2 = 1002; G_ciCMDZOOM_3 = 1003; G_ciCMDZOOM_4 = 1004; G_ciCMDZOOM_6 = 1006; G_ciCMDZOOM_8 = 1008; G_ciCMDZOOM_10 = 1010; G_ciCMDZOOM_12 = 1012; G_ciCMDZOOM_16 = 1016; G_ciCMDZOOM_20 = 1020; G_ciCMDZOOM_UP = 1090; G_ciCMDZOOM_DOWN = 1091; //[Grid] 20 G_ciCMDGRID_DISP = 2010; G_ciCMDGRID_GRAY = 2001; G_ciCMDGRID_BLACK = 2002; G_ciCMDGRID_WHITE = 2003; G_ciCMDGRID_INVERT = 2004; G_ciCMDGRID_TRANSPARENT = 2005; G_ciCMDGRID_SELCOLOR = 2006; G_ciCMDGRID_SUBNONE = 2011; G_ciCMDGRID_SUBBLUE = 2012; G_ciCMDGRID_SUBRED = 2013; G_ciCMDGRID_SELSUBCOLOR = 2014; G_ciCMDGRID_USESUBELSECOLOR = 2021; G_ciCMDGRID_SELSUBELSECOLOR = 2022; //[Color] 30 G_ciCMDCOLOR_RGB = 3001; G_ciCMDCOLOR_HTML = 3002; G_ciCMDCOLOR_COLORREF = 3003; G_ciCMDCOLOR_HSV = 3004; G_ciCMDCOLOR_HLS = 3005; G_ciCMDCOLOR_HLSWIN = 3006; G_ciCMDCOLOR_INFOONOFF = 3099; //[Position] 40 G_ciCMDPOS_SCREEN = 4001; G_ciCMDPOS_MONITOR = 4002; G_ciCMDPOS_CLIENT = 4003; G_ciCMDPOS_USER = 4004; G_ciCMDPOS_USERPOSSET = 4010; G_ciCMDPOS_INFOONOFF = 4099; //[WindowInfo] 50 G_ciCMDWININFO_HANDLE = 5001; G_ciCMDWININFO_CLASSNAME = 5002; G_ciCMDWININFO_TEXT = 5003; G_ciCMDWININFO_WINDOWSIZE = 5004; G_ciCMDWININFO_CLIENTSIZE = 5005; G_ciCMDWININFO_RECT = 5006; G_ciCMDWININFO_CONTROLID = 5007; G_ciCMDWININFO_STYLE = 5008; G_ciCMDWININFO_PARENTWINDOW = 5021; G_ciCMDWININFO_PID = 5022; G_ciCMDWININFO_EXENAME = 5023; G_ciCMDWININFO_FILEVERSION = 5024; G_ciCMDWININFO_STYLEVERBOSE = 5031; G_ciCMDWININFO_STYLEFOLLOWMAIN = 5032; G_ciCMDWININFO_INFOONOFF = 5099; //[Copy] 60 G_ciCMDCOPY_PICTURE = 6001; G_ciCMDCOPY_COLORRGB = 6002; G_ciCMDCOPY_COLORRGBRED = 6003; G_ciCMDCOPY_COLORRGBGREEN = 6004; G_ciCMDCOPY_COLORRGBBLUE = 6005; G_ciCMDCOPY_COLORHTML = 6006; G_ciCMDCOPY_COLORCOLORREF = 6007; G_ciCMDCOPY_COLORHSV = 6008; G_ciCMDCOPY_COLORHSVHUE = 6009; G_ciCMDCOPY_COLORHSVSATURATION = 6010; G_ciCMDCOPY_COLORHSVVALUE = 6011; G_ciCMDCOPY_COLORHLS = 6012; G_ciCMDCOPY_COLORHLSHUE = 6013; G_ciCMDCOPY_COLORHLSSATURATION = 6014; G_ciCMDCOPY_COLORHLSLIGHTNESS = 6015; G_ciCMDCOPY_COLORHLSWIN = 6016; G_ciCMDCOPY_COLORHLSWINHUE = 6017; G_ciCMDCOPY_COLORHLSWINSATURATION = 6018; G_ciCMDCOPY_COLORHLSWINLIGHTNESS = 6019; G_ciCMDCOPY_POSSCREEN = 6020; G_ciCMDCOPY_POSMONITOR = 6021; G_ciCMDCOPY_POSCLIENT = 6022; G_ciCMDCOPY_POSUSER = 6023; G_ciCMDCOPY_WININFOHANDLE = 6024; G_ciCMDCOPY_WININFOCLASSNAME = 6025; G_ciCMDCOPY_WININFOTEXT = 6026; G_ciCMDCOPY_WININFOWINDOWSIZE = 6027; G_ciCMDCOPY_WININFOCLIENTSIZE = 6028; G_ciCMDCOPY_WININFORECT = 6029; G_ciCMDCOPY_WININFOCONTROLID = 6030; G_ciCMDCOPY_WININFOSTYLE = 6031; G_ciCMDCOPY_WININFOSTYLEEX = 6032; G_ciCMDCOPY_WININFOSTYLEVERBOSE = 6033; G_ciCMDCOPY_WININFOPID = 6034; G_ciCMDCOPY_WININFOEXENAME = 6035; G_ciCMDCOPY_WININFOFILEVERSION = 6036; G_ciCMDCOPY_ALL = 6090; G_ciCMDCOPY_OPTUNICODE = 6099; //[Capture] 70 G_ciCMDCAPTURE_LUPE = 7001; G_ciCMDCAPTURE_FIXED = 7002; G_ciCMDCAPTURE_PAUSE = 7011; G_ciCMDCAPTURE_UPDATE = 7012; G_ciCMDCAPTURE_DISP_X1 = 7013; G_ciCMDCAPTURE_MOVECURSORTOPOINT = 7014; G_ciCMDCAPTURE_POINTFROMCURSOR = 7015; //[Option] 80 G_ciCMDOPT_STAYONTOP = 8001; G_ciCMDOPT_TITLEBAR = 8002; G_ciCMDOPT_TOOLBAR = 8004; G_ciCMDOPT_BIGFONT = 8005; G_ciCMDOPT_NOSELFCAPTURE = 8006; G_ciCMDOPT_SMOOTHCAPTURE = 8007; //[Custom] 90 G_ciCMDCUSTOM_SETTING = 9001; G_ciCMDCUSTOM_MENU = 9002; G_ciCMDCUSTOM_TOOLBAR = 9003; G_ciCMDCUSTOM_SHORTCUT = 9004; G_ciCMDCUSTOM_COPY = 9005; //[Menu] 100 G_ciCMDMENU_MAIN = 10001; G_ciCMDMENU_ZOOM = 10002; G_ciCMDMENU_GRID = 10003; G_ciCMDMENU_COLOR = 10004; G_ciCMDMENU_POS = 10005; G_ciCMDMENU_WININFO = 10006; G_ciCMDMENU_COPY = 10007; G_ciCMDMENU_SETTING = 10008; G_ciCMDMENU_CAPTURE = 10009; //[Move] 110 G_ciCMDMOVE_UP = 11001; G_ciCMDMOVE_DOWN = 11002; G_ciCMDMOVE_LEFT = 11003; G_ciCMDMOVE_RIGHT = 11004; G_ciCMDMOVE_MONITOR = 11005; //[File] 120 G_ciCMDFILE_MINIMIZE = 12001; G_ciCMDFILE_EXIT = 12002; //[Help] 130 G_ciCMDHELP = 13001; const //設定データ用フラグ G_ciFLGGRID_DISP = $01; G_ciFLGGRID_ELSECOLOR = $02; G_ciFLGCOLOR_RGB = $01; G_ciFLGCOLOR_HTML = $02; G_ciFLGCOLOR_REF = $04; G_ciFLGCOLOR_HSV = $08; G_ciFLGCOLOR_HLS = $10; G_ciFLGCOLOR_HLSWIN = $20; G_ciFLGPOS_SCREEN = $01; G_ciFLGPOS_MONITOR = $02; G_ciFLGPOS_CLIENT = $04; G_ciFLGPOS_USER = $08; G_ciFLGWINFO_HANDLE = $1; G_ciFLGWINFO_CNAME = $2; G_ciFLGWINFO_TEXT = $4; G_ciFLGWINFO_WSIZE = $8; G_ciFLGWINFO_CSIZE = $10; G_ciFLGWINFO_RECT = $20; G_ciFLGWINFO_CONTROLID = $40; G_ciFLGWINFO_STYLE = $80; G_ciFLGWINFO_PARENT = $100; G_ciFLGWINFO_PID = $200; G_ciFLGWINFO_EXENAME = $400; G_ciFLGWINFO_VERSION = $800; G_ciFLGWINFO_STYLEVERBOSE = $1000; G_ciFLGWINFO_FOLLOWMAIN = $2000; G_ciFLGSTYLE_BUTTON = $1; G_ciFLGSTYLE_EDIT = $2; G_ciFLGSTYLE_STATIC = $4; G_ciFLGSTYLE_COMBOBOX = $8; G_ciFLGSTYLE_LISTBOX = $10; G_ciFLGSTYLE_DIALOG = $20; G_ciFLGSTYLE_SCROLLBAR = $40; G_ciFLGOPT_STAYONTOP = $1; G_ciFLGOPT_TITLEBAR = $2; G_ciFLGOPT_TOOLBAR = $4; G_ciFLGOPT_BIGFONT = $8; G_ciFLGOPT_NOSELF = $10; G_ciFLGOPT_SMOOTH = $20; G_ciFLGOPT_COPYUNICODE = $8000; G_ciFLGCAPTURE_LUPE = $1; G_ciFLGCAPTURE_FIXED = $2; const { キーの増減はNG。 した場合はデータの互換性がなくなる。 } G_ciKEYCOUNT = 62; //ショートカットのキー数 (* G_ciVKEY: array[0..G_ciKEYCOUNT-1] of Word = ( VK_0, VK_1, VK_2, VK_3, VK_4, VK_5, VK_6, VK_7, VK_8, VK_9, VK_SPACE, VK_A, VK_B, VK_C, VK_D, VK_E, VK_F, VK_G, VK_H, VK_I, VK_J, VK_K, VK_L, VK_M, VK_N, VK_O, VK_P, VK_Q, VK_R, VK_S, VK_T, VK_U, VK_V, VK_W, VK_X, VK_Y, VK_Z, VK_F1, VK_F2, VK_F3, VK_F4, VK_F5, VK_F6, VK_F7, VK_F8, VK_F9, VK_F10, VK_F11, VK_F12, VK_EXECUTE, VK_BACK, VK_DELETE, VK_INSERT, VK_ESCAPE, VK_PRIOR, VK_NEXT, VK_HOME, VK_END, VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT ); *) type T_ShortCutKey = packed record iKey: Word; iCommand: Word; end; T_MouseGesture = packed record iCommand_Up, iCommand_Down, iCommand_Left, iCommand_Right: Word; end; type T_SettingHeader = packed record iIdentifier: array[0..3] of Byte; //4バイトの識別子 //[Data Version] //本体のバージョンではなく設定ファイルのバージョン iMajor: Byte; //0〜255 iMinor: Byte; //0〜255 //予備 iReserved1: DWORD; iReserved2: DWORD; iReserved3: DWORD; iReserved4: DWORD; end; //設定データ。 //変更不可。 //変更した場合は設定ファイルの互換性が無くなる。 T_SettingInfo = packed record //[Bounds] rcRect: TRect; //[Zoom] iZoomIndex: Byte; //0〜255 //[Grid] iGridFlag: Word; //16個 ビットフラグ iGridIndex: Byte; //0〜255 iSubGridIndex: Byte; //0〜255 clGridColor: DWORD; //グリッドカラー clSubGridColor: DWORD; //サブグリッドカラー clSubGridElseColor: DWORD; //サブグリッド2色目 //[Color] iColorFlag: Word; //16個 ビットフラグ //[Position] iPosFlag: Word; //16個 ビットフラグ ptUserPos: TPoint; //[WindowInfo] iWInfoFlag: Longword; //32個 ビットフラグ iStyleFlag: Longword; //32個 ビットフラグ //[Option] iOptFlag: Word; //16個 ビットフラグ //[Capture] iCaptureFlag: Word; //16個 ビットフラグ ptCaptruePos: TPoint; end; const //ショートカットキー //仮想キーコード、デフォルトのコマンド(0は未設定) G_rINIT_SHORTCUTKEYS: array[0..G_ciKEYCOUNT-1] of T_ShortCutKey = ( (iKey: VK_0; iCommand: 0), (iKey: VK_1; iCommand: G_ciCMDCAPTURE_DISP_X1), //実寸表示 (iKey: VK_2; iCommand: 0), (iKey: VK_3; iCommand: 0), (iKey: VK_4; iCommand: 0), (iKey: VK_5; iCommand: 0), (iKey: VK_6; iCommand: 0), (iKey: VK_7; iCommand: 0), (iKey: VK_8; iCommand: 0), (iKey: VK_9; iCommand: 0), (iKey: VK_SPACE; iCommand: G_ciCMDPOS_USERPOSSET), //ユーザー指定座標の原点をセット (iKey: VK_A; iCommand: 0), (iKey: VK_B; iCommand: 0), (iKey: VK_C; iCommand: G_ciCMDCOPY_COLORCOLORREF), //COLORREFをコピー (iKey: VK_D; iCommand: 0), (iKey: VK_E; iCommand: 0), (iKey: VK_F; iCommand: G_ciCMDCAPTURE_FIXED), (iKey: VK_G; iCommand: 0), (iKey: VK_H; iCommand: G_ciCMDCOPY_COLORHTML), (iKey: VK_I; iCommand: 0), (iKey: VK_J; iCommand: 0), (iKey: VK_K; iCommand: 0), (iKey: VK_L; iCommand: 0), (iKey: VK_M; iCommand: G_ciCMDMENU_MAIN), (iKey: VK_N; iCommand: 0), (iKey: VK_O; iCommand: 0), (iKey: VK_P; iCommand: 0), (iKey: VK_Q; iCommand: G_ciCMDMOVE_MONITOR), (iKey: VK_R; iCommand: 0), (iKey: VK_S; iCommand: G_ciCMDOPT_SMOOTHCAPTURE), (iKey: VK_T; iCommand: 0), (iKey: VK_U; iCommand: 0), (iKey: VK_V; iCommand: 0), (iKey: VK_W; iCommand: 0), (iKey: VK_X; iCommand: 0), (iKey: VK_Y; iCommand: 0), (iKey: VK_Z; iCommand: G_ciCMDCOPY_PICTURE), (iKey: VK_F1; iCommand: G_ciCMDHELP), (iKey: VK_F2; iCommand: 0), (iKey: VK_F3; iCommand: 0), (iKey: VK_F4; iCommand: 0), (iKey: VK_F5; iCommand: G_ciCMDCAPTURE_UPDATE), (iKey: VK_F6; iCommand: G_ciCMDCAPTURE_PAUSE), (iKey: VK_F7; iCommand: 0), (iKey: VK_F8; iCommand: 0), (iKey: VK_F9; iCommand: 0), (iKey: VK_F10; iCommand: 0), (iKey: VK_F11; iCommand: 0), (iKey: VK_F12; iCommand: 0), (iKey: VK_EXECUTE; iCommand: 0), (iKey: VK_BACK; iCommand: 0), (iKey: VK_DELETE; iCommand: 0), (iKey: VK_INSERT; iCommand: 0), (iKey: VK_ESCAPE; iCommand: G_ciCMDCAPTURE_PAUSE), (iKey: VK_PRIOR; iCommand: G_ciCMDZOOM_UP), (iKey: VK_NEXT; iCommand: G_ciCMDZOOM_DOWN), (iKey: VK_HOME; iCommand: 0), (iKey: VK_END; iCommand: 0), (iKey: VK_UP; iCommand: G_ciCMDMOVE_UP), (iKey: VK_DOWN; iCommand: G_ciCMDMOVE_DOWN), (iKey: VK_LEFT; iCommand: G_ciCMDMOVE_LEFT), (iKey: VK_RIGHT; iCommand: G_ciCMDMOVE_RIGHT) ); //マウスジェスチャ G_rINIT_MOUSEGESTURE: T_MouseGesture = ( iCommand_Up : G_ciCMDOPT_STAYONTOP; iCommand_Down : G_ciCMDOPT_NOSELFCAPTURE; iCommand_Left : G_ciCMDGRID_DISP; iCommand_Right : G_ciCMDCAPTURE_PAUSE ); var { 設定データ、ショートカットキー、マウスジェスチャのサイズは固定。 メニュー、ツールバーのサイズは可変。 メニュー、ツールバーの設定値は最初に設定値の個数(Word)がありその後に個数分のデー タ(Wordの羅列)が続く。 } //設定データ(バイナリ) G_rSettingInfo: T_SettingInfo; //ショートカットキー G_rShortCutKeys: array[0..G_ciKEYCOUNT-1] of T_ShortCutKey; //マウスジェスチャ G_rMouseGesture: T_MouseGesture; {$IFDEF MEGALO_BUG} //以下は設定によってサイズが可変 //メニュー(非表示のメニューを羅列) G_MenuHideItem: array of Word; //ツールバー(表示するツールボタンのアクション) G_ToolBarAction: array of Word; {$ENDIF} //デフォルト設定値のセット procedure G_pcShortCutInit; //設定データ書き込み procedure G_pcSettingWrite; //設定データ読み込み function G_fnbSettingRead: Boolean; implementation uses {$IFDEF DEBUG} myDebug, {$ENDIF} {$IFDEF MEGALO_BUG} custom_menu, custom_toolbar, {$ENDIF} general; procedure G_pcShortCutInit; //デフォルト設定値のセット var i: Integer; begin //ショートカットキー for i := 0 to High(G_rShortCutKeys) do begin G_rShortCutKeys[i].iKey := G_rINIT_SHORTCUTKEYS[i].iKey; G_rShortCutKeys[i].iCommand := G_rINIT_SHORTCUTKEYS[i].iCommand; end; //マウスジェスチャ G_rMouseGesture.iCommand_Up := G_rINIT_MOUSEGESTURE.iCommand_Up; G_rMouseGesture.iCommand_Down := G_rINIT_MOUSEGESTURE.iCommand_Down; G_rMouseGesture.iCommand_Left := G_rINIT_MOUSEGESTURE.iCommand_Left; G_rMouseGesture.iCommand_Right:= G_rINIT_MOUSEGESTURE.iCommand_Right; end; const FcsSETTINGFILE_EXT = '.bin'; {$IFDEF MEGALO_BUG} FciSETTING_IDENTIFIER_0 = VK_M; {$ELSE} {$IFDEF LARGE_BUG} FciSETTING_IDENTIFIER_0 = VK_L; {$ELSE} FciSETTING_IDENTIFIER_0 = VK_S; {$ENDIF} {$ENDIF} FciSETTING_IDENTIFIER_1 = VK_B; FciSETTING_IDENTIFIER_2 = VK_U; FciSETTING_IDENTIFIER_3 = VK_G; FciSETTING_VERMAJOR = 1; FciSETTING_VERMINOR = 1; function G_fnbSettingRead: Boolean; //設定値を読み込むだけ。 //設定のセットはこのルーチンを呼び出した側で行う。 var lh_Handle: THandle; ls_File: WideString; l_rHeader: T_SettingHeader; // li_Count: Word; //Wordである必要あり li_FileSize, li_BinSize, li_Read: DWORD; begin Result := False; //Shift+Ctrl終了で設定を書き込まない。 if (gfnbKeyState(VK_SHIFT) and gfnbKeyState(VK_CONTROL)) then begin Exit; end; ls_File := gfnsFileExtChange(gfnsExeNameGet, FcsSETTINGFILE_EXT); if not(gfnbFileExists(ls_File)) then begin Exit; end; if (G_bIsNTOS) then begin lh_Handle := CreateFileW( PWideChar(ls_File), //ファイル名 GENERIC_READ, //アクセスモード FILE_SHARE_READ or FILE_SHARE_WRITE , //共有モード nil, //セキュリティ OPEN_EXISTING, //作成方法 FILE_ATTRIBUTE_NORMAL, //ファイル属性 0 //テンプレート ); end else begin lh_Handle := CreateFile( PAnsiChar(AnsiString(ls_File)), //ファイル名 GENERIC_READ, //アクセスモード FILE_SHARE_READ or FILE_SHARE_WRITE , //共有モード nil, //セキュリティ OPEN_EXISTING, //作成方法 FILE_ATTRIBUTE_NORMAL, //ファイル属性 0 //テンプレート ); end; try li_BinSize := SizeOf(l_rHeader) + SizeOf(G_rSettingInfo) + SizeOf(G_rShortCutKeys) + SizeOf(G_rMouseGesture) ; li_FileSize := gfniFileSizeGet(lh_Handle); if (li_FileSize < li_BinSize) then begin Exit; end; if (lh_Handle <> INVALID_HANDLE_VALUE) then begin ReadFile(lh_Handle, l_rHeader, SizeOf(l_rHeader), li_Read, nil); if (l_rHeader.iIdentifier[0] = FciSETTING_IDENTIFIER_0) and (l_rHeader.iIdentifier[1] = FciSETTING_IDENTIFIER_1) and (l_rHeader.iIdentifier[2] = FciSETTING_IDENTIFIER_2) and (l_rHeader.iIdentifier[3] = FciSETTING_IDENTIFIER_3) and (l_rHeader.iMajor = FciSETTING_VERMAJOR) and (l_rHeader.iMinor = FciSETTING_VERMINOR) then begin ReadFile(lh_Handle, G_rSettingInfo, SizeOf(G_rSettingInfo), li_Read, nil); ReadFile(lh_Handle, G_rShortCutKeys, SizeOf(G_rShortCutKeys), li_Read, nil); ReadFile(lh_Handle, G_rMouseGesture, SizeOf(G_rMouseGesture), li_Read, nil); {$IFDEF MEGALO_BUG} //[メニュー] Inc(li_BinSize, SizeOf(li_Count)); if (li_FileSize >= li_BinSize) then begin ReadFile(lh_Handle, li_Count, SizeOf(li_Count), li_Read, nil); if (li_Count > 0) then begin Inc(li_BinSize, SizeOf(Word) * li_Count); SetLength(G_MenuHideItem, li_Count); //record型はそのまま渡せばよいが配列は先頭のアドレスを渡す必要があるようだ。 //またサイズはSizeOf(G_MenuHideItem)とするとポインターのサイズ(4)が返るので //SizeOf(Word) * li_Countとしなければならない。 ReadFile(lh_Handle, G_MenuHideItem[0], SizeOf(Word) * li_Count, li_Read, nil); end; end; //[ツールバー] Inc(li_BinSize, SizeOf(li_Count)); if (li_FileSize >= li_BinSize) then begin ReadFile(lh_Handle, li_Count, SizeOf(li_Count), li_Read, nil); if (li_Count > 0) then begin SetLength(G_ToolBarAction, li_Count); //record型はそのまま渡せばよいが配列は先頭のアドレスを渡す必要があるようだ。 //またサイズはSizeOf(G_ToolBarAction)とするとポインターのサイズ(4)が返るので //SizeOf(Word) * li_Countとしなければならない。 ReadFile(lh_Handle, G_ToolBarAction[0], SizeOf(Word) * li_Count, li_Read, nil); end; end; {$ENDIF} Result := True; end; end; finally CloseHandle(lh_Handle); end; end; procedure G_pcSettingWrite; var li_ErrMode: UINT; ls_File: WideString; lh_Handle: THandle; l_rHeader: T_SettingHeader; li_Write: DWORD; begin li_ErrMode := SetErrorMode(SEM_FAILCRITICALERRORS); try ls_File := gfnsFileExtChange(gfnsExeNameGet, FcsSETTINGFILE_EXT); //myDebug.gpcDebug(ls_File); if (G_bIsNtOs) then begin //NT系OS lh_Handle := CreateFileW( PWideChar(ls_File), //ファイル名 GENERIC_WRITE, //アクセスモード 0, //共有モード nil, //セキュリティ CREATE_ALWAYS, //作成方法 FILE_ATTRIBUTE_NORMAL, //ファイル属性 0 //テンプレート ); end else begin //9x系OS lh_Handle := CreateFile( PAnsiChar(AnsiString(ls_File)), //ファイル名 GENERIC_WRITE, //アクセスモード 0, //共有モード nil, //セキュリティ CREATE_ALWAYS, //作成方法 FILE_ATTRIBUTE_NORMAL, //ファイル属性 0 //テンプレート ); end; if (lh_Handle <> INVALID_HANDLE_VALUE) then begin try FillChar(l_rHeader, SizeOf(l_rHeader), 0); with l_rHeader do begin //識別子 iIdentifier[0] := FciSETTING_IDENTIFIER_0; iIdentifier[1] := FciSETTING_IDENTIFIER_1; iIdentifier[2] := FciSETTING_IDENTIFIER_2; iIdentifier[3] := FciSETTING_IDENTIFIER_3; //[Data Version] iMajor := FciSETTING_VERMAJOR; iMinor := FciSETTING_VERMINOR; end; WriteFile(lh_Handle, l_rHeader, SizeOf(l_rHeader), li_Write, nil); WriteFile(lh_Handle, G_rSettingInfo, SizeOf(G_rSettingInfo), li_Write, nil); WriteFile(lh_Handle, G_rShortCutKeys, SizeOf(G_rShortCutKeys), li_Write, nil); WriteFile(lh_Handle, G_rMouseGesture, SizeOf(G_rMouseGesture), li_Write, nil); {$IFDEF MEGALO_BUG} gpcWriteBinMenu (lh_Handle); gpcWriteBinToolBar(lh_Handle); {$ENDIF} finally CloseHandle(lh_Handle); end; end; except end; SetErrorMode(li_ErrMode); end; initialization FillChar(G_rSettingInfo, SizeOf(G_rSettingInfo), 0); end.