-
Notifications
You must be signed in to change notification settings - Fork 5
/
Charu3.h
323 lines (265 loc) · 8.15 KB
/
Charu3.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
/*----------------------------------------------------------
Charu3ヘッダ
2002/11/16 (c)Keizi
----------------------------------------------------------*/
#if !defined(AFX_CHARU3_H__05C003AF_297C_4BFB_AFB3_822EAE3D3787__INCLUDED_)
#define AFX_CHARU3_H__05C003AF_297C_4BFB_AFB3_822EAE3D3787__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#if defined(UNICODE) || defined(_UNICODE)
#pragma comment(linker, "/entry:\"wWinMainCRTStartup\"")
#endif
#define ROOT -1
#include "resource.h" // メイン シンボル
#include "Charu3Tree.h"
#include "MyTreeDialog.h"
#include "ClipBord.h"
#include "Init.h"
#include "MainFrm.h"
#include "General.h"
#include <list>
using namespace std;
//バージョン表記
#ifdef _UNICODE
#define ABOUT_NAME _T("Charu3 Version 7.06.07 Unicode")
#else
#define ABOUT_NAME _T("Charu3 Version 7.06.07")
#endif
//ファイル名設定
#define INI_FILE _T("Charu3.ini")
#define DAT_FILE _T("Charu3.c3d")
#define HELP_FILE _T("Doc\\index.html")
#define DAT_FORMAT "Charu3Data1.0"
#define DAT_FORMAT2 "Charu3Data1.1"
#define DAT_EXT "c3d"
#define DAT_FILE_BK "_bkup."
#define MACRO_START _T("<charuMACRO>")
#define MACRO_END _T("</charuMACRO>")
#define MACRO_START_KEY _T("<charuMACRO_KEY>")
#define MACRO_END_KEY _T("</charuMACRO_KEY>")
#define ICON_SIZE 18
#define TEXTBOX_FONT_SIZE 90
#define HOTKEY_POPUP 0
#define HOTKEY_FIFO 1
#define HOTKEY_PASTE 2
#define HOT_ITEM_KEY 3
#define SZTASKBAR_CLASS "Shell_TrayWnd"
#define SZTRAY_CLASS "TrayNotifyWnd"
#define TITL_LENGTH 64 //タイトル文字列の長さ
#define TIMER_SELF_DIAGNOSIS 605
#define TIMER_ACTIVE 606
#define TIMER_MOUSE 607
#define CHARU_QUICK_TIMER 610
#define WM_TASKTRAY (WM_USER+100)
#define WM_WORD_CLIP (WM_USER+101)
#define WM_TREE_CLOSE (WM_USER+102)
#define WM_TIPS_CHANGE (WM_USER+103)
#define WM_KEY_HOOK (WM_USER+104)
//ポップアップ位置種別
#define POPUP_POS_CARET 0
#define POPUP_POS_MOUSE 1
#define POPUP_POS_LEFT_U 2
#define POPUP_POS_RIGHT_U 3
#define POPUP_POS_CENTOR 4
#define POPUP_POS_LEFT_D 5
#define POPUP_POS_RIGHT_D 6
//キャプションのマッチ方法
#define MATCH_FORWORD 0
#define MATCH_BACK 1
#define MATCH_INCLUDE 2
#define MATCH_PHRASE 3
//拡張マクロ
#define EXMACRO_DIRECT_COPY "directcopykey"
#define EXMACRO_HOT_KEY "hotkey"
//データ種別
#define KIND_ONETIME 0x01 //ワンタイム項目
#define KIND_LOCK 0x02 //ノーマル項目
#define KIND_FOLDER 0x04 //フォルダ項目
#define KIND_RIREKI 0x08 //履歴フォルダ
#define KIND_DATA_ALL 0x03 //データ
#define KIND_FOLDER_ALL 0x0C //フォルダ
#define FOLDER_OPEN 0x10 //フォルダオープンマスク
//データアイコン種別
#define KIND_DEFAULT 0 //アイコン指定無し
#define KIND_DATE 1 //日付
#define KIND_EXE 2 //実行
#define KIND_RELATE 3 //関連付け
#define KIND_SELECT 4 //選択
#define KIND_CLIP 5 //クリップボード
#define KIND_PLUG 6 //プラグイン
#define KIND_KEY 7 //キーマクロ
//アイコン番号
#define ICON_FOLDER 0
#define ICON_RIREKI_FOLDER 2
#define ICON_ONETIME 4
#define ICON_KEY 6
#define ICON_DATE 8
#define ICON_EXE 10
#define ICON_RELATE 12
#define ICON_SELECT 14
#define ICON_CLIP 16
#define ICON_PLUG 18
#define ICON_KEYM 20
#define KEY_DOWN 0x01
#define KEY_UP 0x02
//検索種別
#define SERCH_KIND_TITLE 0
#define SERCH_KIND_TEXT 1
#define SERCH_KIND_ALL 2
#define SERCH_LOGIC_AND 0
#define SERCH_LOGIC_OR 1
//キャプションのマッチ方法
#define MATCH_FORWORD 0
#define MATCH_BACK 1
#define MATCH_INCLUDE 2
#define MATCH_PHRASE 3
#define PHASE_START 0x00
#define PHASE_IDOL 0x01
#define PHASE_POPUP 0x02
#define PHASE_OPTION 0x04
#define PHASE_LOCK 0x08
//プラグイン関数宣言
typedef bool(*CharuPlugIn)(TCHAR*,TCHAR*,int,STRING_DATA*,void*);
typedef bool (*setHook)(const HWND hWnd, const int msg);
typedef void (*unHook)(void);
#define FILEEXIST(s) (::GetFileAttributes(s) != 0xFFFFFFFF)
//---------------------------------------------------
// ホットキー設定構造体
//---------------------------------------------------
struct HOT_KEY_CODE
{
UINT m_uModKey;
UINT m_uVkCode;
bool m_isDoubleClick;
HTREEITEM m_hItem;
int m_nDataID;
DWORD m_dwDoubleKeyTime;
CString m_strMacroName;
};
struct KEY_CODE_NAME
{
CString strName;
int nKeyCode;
};
//---------------------------------------------------
// クラス定義
//---------------------------------------------------
class CCharu3App : public CWinApp
{
public:
CCharu3App();
~CCharu3App();
void popupTreeWindow(POINT pos,int nSelect,HTREEITEM hOpenItem = NULL);
void closeTreeWindow(int nRet);
void pasteData(CString strPaste,COPYPASTE_KEY key,HWND hWnd);
void execData(CString strPaste,COPYPASTE_KEY key,HTREEITEM hTargetItem,HWND hWnd);
void execKeyMacro(CString strKeyMacro);
CString getSelectString(COPYPASTE_KEY key,HWND hWnd = NULL);
void keyUpDown(UINT uMod,UINT uVKCode,int nFlag);
void keyUpDownC2(UINT uMod,UINT uVKCode,int nFlag);
void keyUpDownMessage(UINT uMod,UINT uVKCode,int nFlag,HWND hWnd);
void registerHotkey();
void stopHotkey();
void setAppendHotKey();
void stopAppendHotKey();
CString convertMacro(STRING_DATA *SourceData,CString strSelect,CString strClip,CString strSoftName);
CString convertMacroPlugin(STRING_DATA *SourceData,CString strSelect,CString strClip,CString strSoftName);
HWND getAppWnd(){return m_hSelfWnd;}
bool isCloseKey(){return m_isCloseKey;}
void popupTreeWinMC(HWND hForeground);
void changeClipBord(CString strClipBord);
void toggleStockMode();
bool getStockSW(){return m_isStockMode;}
int getPhase() {return m_nPhase;}
void fifoClipbord();
void resetTreeDialog();
CMyTreeDialog *m_pTreeDlg;
CInit m_ini;
CClipBord m_clipbord;
CCharu3Tree *m_pTree;
CMainFrame *m_pMainFrame;
COPYPASTE_KEY m_keySet;
FOCUS_INFO m_focusInfo;
// オーバーライド
// ClassWizard は仮想関数のオーバーライドを生成します。
//{{AFX_VIRTUAL(CCharu3App)
public:
virtual BOOL InitInstance();
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
virtual int ExitInstance();
//}}AFX_VIRTUAL
// インプリメンテーション
public:
//{{AFX_MSG(CCharu3App)
afx_msg void OnAppAbout();
afx_msg void OnAbout();
afx_msg void OnHelp();
afx_msg void OnExit();
afx_msg void OnOption();
afx_msg void OnDataSave();
afx_msg void OnOnetimeClear();
afx_msg void OnAllLock();
afx_msg void OnChangData();
afx_msg void OnAddData();
afx_msg void OnIconDecide();
afx_msg void OnBbsOpen();
afx_msg void OnStockStop();
afx_msg void OnVisualFile();
afx_msg void OnResetTree();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
protected:
void getPopupPos(POINT *pPos,int nPosType);
bool cornerPopup();
void reviseWindowPos(POINT *pos);
void convHotKeyConf(CString strKey,UINT *pMod,UINT *pVK,bool *isDoubleClick);
int getKeycode(TCHAR *szKeyName);
bool setAppendKeyInit(HWND hTopWindow,COPYPASTE_KEY *keySet);
void playHotItem(int nTarget);
void playData(STRING_DATA data,CString strClip,CString strSelect,bool isPaste,bool isChange = true);
HTREEITEM m_hSelectItemBkup;
DWORD m_dwDoubleKeyPopTime,m_dwDoubleKeyFifoTime;
vector<HOT_KEY_CODE> m_hotkeyVector;
KEY_CODE_NAME m_keyStruct[256];
void init();
HANDLE m_hMutex; //重複起動判別ハンドル
HWND m_hActiveKeyWnd;
HWND m_hSelfWnd;
HINSTANCE m_hLangDll;
bool m_isCloseKey,m_isStockMode,m_isCornerPopup,m_isWordBugClipCheck;
BOOL m_isImeStatus;
int m_nPhase;
CString m_strlClipBackup;
};
//---------------------------------------------------
// アプリケーションのバージョン情報で使われる CAboutDlg ダイアログ
//---------------------------------------------------
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// ダイアログ データ
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
CString m_strVersion;
//}}AFX_DATA
// ClassWizard 仮想関数のオーバーライドを生成します。
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV のサポート
//}}AFX_VIRTUAL
// インプリメンテーション
protected:
//{{AFX_MSG(CAboutDlg)
afx_msg void OnWeb();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ は前行の直前に追加の宣言を挿入します。
#endif // !defined(AFX_CHARU3_H__05C003AF_297C_4BFB_AFB3_822EAE3D3787__INCLUDED_)