• R/O
  • SSH
  • HTTPS

dataviewer: Commit


Commit MetaInfo

Révision14 (tree)
l'heure2012-07-30 17:59:42
Auteurberupon

Message de Log

Windowsの機能を使ったクリップボード機能を実装。アプリケーションを再度起動した時に前回の設定を復帰できるようにする。

Change Summary

Modification

--- trunk/DataView.h (revision 13)
+++ trunk/DataView.h (revision 14)
@@ -6,6 +6,8 @@
66 class IBuffer2D;
77 }
88
9+#include "setting.h"
10+
911 class CDataView : public CWindowImpl<CDataView>
1012 {
1113 public:
@@ -17,9 +19,14 @@
1719 void ProcessData();
1820
1921 BOOL PreTranslateMessage(MSG* pMsg);
20- struct ProcessSetting& GetSetting() { return *m_pSetting; }
21- void ReadData(const ProcessSetting& setting);
22- void ProcessData(const ProcessSetting& setting);
22+ ProcessSetting& GetProcessSetting() {
23+ return m_processSetting;
24+ }
25+ const IDataSetting* GetDataSetting() {
26+ return m_pDataSetting.get();
27+ }
28+ void ReadData(const ProcessSetting& setting, boost::shared_ptr<IDataSetting>& pDataSetting);
29+ void ProcessData(const ProcessSetting& setting, boost::shared_ptr<IDataSetting>& pDataSetting);
2330
2431 void ZoomIn();
2532 void ZoomOut();
@@ -44,7 +51,8 @@
4451 END_MSG_MAP()
4552
4653 private:
47- boost::shared_ptr<struct ProcessSetting> m_pSetting;
54+ ProcessSetting m_processSetting;
55+ boost::shared_ptr<IDataSetting> m_pDataSetting;
4856 std::vector<char> m_data;
4957 std::vector<double> m_values;
5058
--- trunk/SettingDialog_2D.cpp (revision 13)
+++ trunk/SettingDialog_2D.cpp (revision 14)
@@ -9,6 +9,7 @@
99
1010 #include "TwoWayMap.h"
1111 #include "converter.h"
12+#include "arrayutil.h"
1213
1314 #include "Setting.h"
1415
@@ -170,21 +171,21 @@
170171
171172 void CSettingDialog_2D::RetrieveSetting(boost::shared_ptr<IDataSetting>& pSetting)
172173 {
173- boost::shared_ptr<DataSetting2D> ps = boost::shared_ptr<DataSetting2D>(new DataSetting2D);
174- pSetting = ps;
174+ DataSetting2D* ps = new DataSetting2D;
175+ pSetting = boost::shared_ptr<DataSetting2D>(ps);
175176
176177 CString str;
177178 m_wndCmbTargetStructureType.GetLBText(m_wndCmbTargetStructureType.GetCurSel(), str);
178179 ps->targetStructureType = targetStructureTypeMapper[str];
179- m_wndEdtTargetStructureAddress.GetWindowText(ps->structureAddressFormula);
180- m_wndEdtWidth.GetWindowText(ps->widthFormula);
181- m_wndEdtHeight.GetWindowText(ps->heightFormula);
180+ m_wndEdtTargetStructureAddress.GetWindowText(ps->structureAddressFormula, Count(ps->structureAddressFormula));
181+ m_wndEdtWidth.GetWindowText(ps->widthFormula, Count(ps->widthFormula));
182+ m_wndEdtHeight.GetWindowText(ps->heightFormula, Count(ps->heightFormula));
182183 if (IsDlgButtonChecked(IDC_RAD_ADDRESSEDLINE_FIRST) == BST_CHECKED) {
183184 ps->addressedLine = DataSetting2D::AddressedLine_First;
184185 }else if (IsDlgButtonChecked(IDC_RAD_ADDRESSEDLINE_LAST) == BST_CHECKED) {
185186 ps->addressedLine = DataSetting2D::AddressedLine_Last;
186187 }
187- m_wndEdtLineOffset.GetWindowText(ps->lineOffsetFormula);
188+ m_wndEdtLineOffset.GetWindowText(ps->lineOffsetFormula, Count(ps->lineOffsetFormula));
188189 m_wndCmbColorFormat.GetLBText(m_wndCmbColorFormat.GetCurSel(), str);
189190 ps->colorFormat = colorFormatTypeMapper[str];
190191 }
--- trunk/Setting.h (revision 13)
+++ trunk/Setting.h (revision 14)
@@ -1,5 +1,7 @@
11 #pragma once
22
3+#pragma pack(push,1)
4+
35 enum DataSourceKeyType
46 {
57 DataSourceKeyType_ImageName,
@@ -36,10 +38,10 @@
3638 DataSetting1D();
3739
3840 DataType dataType;
39- CString countFormula;
41+ TCHAR countFormula[128];
4042 bool viewAuto;
41- CString viewMinFormula;
42- CString viewMaxFormula;
43+ TCHAR viewMinFormula[128];
44+ TCHAR viewMaxFormula[128];
4345
4446 size_t GetTotalBytes() const;
4547 size_t GetElementSize() const;
@@ -78,11 +80,11 @@
7880 };
7981
8082 TargetStructureType targetStructureType;
81- CString structureAddressFormula;
83+ TCHAR structureAddressFormula[128];
8284
83- CString widthFormula;
84- CString heightFormula;
85- CString lineOffsetFormula;
85+ TCHAR widthFormula[128];
86+ TCHAR heightFormula[128];
87+ TCHAR lineOffsetFormula[128];
8688 AddressedLine addressedLine;
8789 ColorFormatType colorFormat;
8890
@@ -92,7 +94,7 @@
9294
9395 struct DataSettingTEXT : IDataSetting
9496 {
95- CString bytesFormula;
97+ TCHAR bytesFormula[128];
9698 size_t GetTotalBytes() const;
9799 int GetAddressOffset() const;
98100 };
@@ -102,12 +104,12 @@
102104 ProcessSetting();
103105
104106 DataSourceKeyType dataSourceKeyType;
105- CString imageName;
107+ TCHAR imageName[128];
106108 DWORD pid;
107- CString addressBaseFormula;
108- CString addressOffsetFormula;
109+ TCHAR addressBaseFormula[128];
110+ TCHAR addressOffsetFormula[128];
109111 int addressOffsetMultiplier;
110112
111- boost::shared_ptr<IDataSetting> pDataSetting;
112113 };
113114
115+#pragma pack(pop)
--- trunk/main.cpp (revision 13)
+++ trunk/main.cpp (revision 14)
@@ -15,7 +15,7 @@
1515 _Module.AddMessageLoop(&theLoop);
1616
1717 CMainFrame wndMain;
18- CRect rec(0,0, 800,600);
18+ CRect rec(0,0, 1024,768);
1919 if(wndMain.CreateEx(NULL,rec) == NULL)
2020 {
2121 ATLTRACE(_T("Main window creation failed!\n"));
--- trunk/resource.h (revision 13)
+++ trunk/resource.h (revision 14)
@@ -78,6 +78,8 @@
7878 #define ID_VIEW_ZOOMOUT 32780
7979 #define ID_VIEW_ZOOMRESET 32781
8080 #define ID_HAND 32782
81+#define ID_EDIT_COPY32783 32783
82+#define ID_EDIT_PASTE32784 32784
8183
8284 // Next default values for new objects
8385 //
@@ -84,7 +86,7 @@
8486 #ifdef APSTUDIO_INVOKED
8587 #ifndef APSTUDIO_READONLY_SYMBOLS
8688 #define _APS_NEXT_RESOURCE_VALUE 206
87-#define _APS_NEXT_COMMAND_VALUE 32783
89+#define _APS_NEXT_COMMAND_VALUE 32789
8890 #define _APS_NEXT_CONTROL_VALUE 1058
8991 #define _APS_NEXT_SYMED_VALUE 101
9092 #endif
--- trunk/MainFrm.h (revision 13)
+++ trunk/MainFrm.h (revision 14)
@@ -1,6 +1,7 @@
11 #pragma once
22
33 struct ProcessSetting;
4+struct IDataSetting;
45
56 class CMainFrame
67 :
@@ -22,9 +23,9 @@
2223
2324 HWND CreateClient();
2425
25- void ReadData(const ProcessSetting& setting);
26- void ProcessData(const ProcessSetting& setting);
27- void SetSettingView(const ProcessSetting& setting);
26+ void ReadData(const ProcessSetting& setting, boost::shared_ptr<IDataSetting>& pDataSetting);
27+ void ProcessData(const ProcessSetting& setting, boost::shared_ptr<IDataSetting>& pDataSetting);
28+ void SetSettingView(const ProcessSetting& setting, const IDataSetting* pDataSetting);
2829 void updateUI();
2930
3031 virtual BOOL PreTranslateMessage(MSG* pMsg);
@@ -51,6 +52,8 @@
5152 COMMAND_ID_HANDLER(ID_WINDOW_TILE_HORZ, OnWindowTile)
5253 COMMAND_ID_HANDLER_EX(ID_HAND, OnHand)
5354 COMMAND_ID_HANDLER_EX(ID_ZOOM, OnZoom)
55+ COMMAND_ID_HANDLER_EX(ID_EDIT_COPY, OnEditCopy)
56+ COMMAND_ID_HANDLER_EX(ID_EDIT_PASTE, OnEditPaste)
5457
5558 // COMMAND_ID_HANDLER(ID_WINDOW_ARRANGE, OnWindowArrangeIcons)
5659 CHAIN_MSG_MAP(CUpdateUI<CMainFrame>)
@@ -78,4 +81,6 @@
7881 LRESULT OnWindowArrangeIcons(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
7982 LRESULT OnHand(WORD wNotifyCode, WORD wID, HWND hWndCtl);
8083 LRESULT OnZoom(WORD wNotifyCode, WORD wID, HWND hWndCtl);
84+ LRESULT OnEditCopy(WORD wNotifyCode, WORD wID, HWND hWndCtl);
85+ LRESULT OnEditPaste(WORD wNotifyCode, WORD wID, HWND hWndCtl);
8186 };
--- trunk/SettingDialog_TEXT.cpp (revision 13)
+++ trunk/SettingDialog_TEXT.cpp (revision 14)
@@ -4,6 +4,7 @@
44
55 #include "converter.h"
66 #include "Setting.h"
7+#include "arrayutil.h"
78
89 CSettingDialog_TEXT::CSettingDialog_TEXT()
910 {
@@ -34,7 +35,7 @@
3435 {
3536 try {
3637 CString str;
37- GetDlgItemText(IDC_EDT_BYTES, setting.bytesFormula);
38+ GetDlgItemText(IDC_EDT_BYTES, setting.bytesFormula, Count(setting.bytesFormula));
3839 }catch(...) {
3940 ;
4041 }
@@ -43,8 +44,8 @@
4344
4445 void CSettingDialog_TEXT::RetrieveSetting(boost::shared_ptr<IDataSetting>& pSetting)
4546 {
46- boost::shared_ptr<DataSettingTEXT> ps = boost::shared_ptr<DataSettingTEXT>(new DataSettingTEXT);
47+ DataSettingTEXT* ps = new DataSettingTEXT();
4748 RetreiveSetting(*ps);
48- pSetting = ps;
49+ pSetting = boost::shared_ptr<DataSettingTEXT>(ps);
4950 }
5051
--- trunk/SettingDialog.h (revision 13)
+++ trunk/SettingDialog.h (revision 14)
@@ -2,6 +2,7 @@
22
33 #include "resource.h" // main symbols
44 #include "AutoCombo.h"
5+#include "Setting.h"
56
67 struct ProcessSetting;
78
@@ -28,8 +29,6 @@
2829 COMMAND_HANDLER(IDC_BTN_READ, BN_CLICKED, OnBnClickedBtnRead)
2930 COMMAND_HANDLER(IDC_CHK_READ_AUTO, BN_CLICKED, OnBnClickedChkReadAuto)
3031 COMMAND_HANDLER(IDC_BTN_PROCESS, BN_CLICKED, OnBnClickedBtnProcess)
31- COMMAND_HANDLER_EX(IDC_BTN_COPY, BN_CLICKED, OnBtnCopyBnClicked)
32- COMMAND_HANDLER_EX(IDC_BTN_PASTE, BN_CLICKED, OnBtnPasteBnClicked)
3332 NOTIFY_HANDLER_EX(IDC_TAB, TCN_SELCHANGE, OnTabTcnSelChange)
3433 REFLECT_NOTIFICATIONS()
3534 END_MSG_MAP()
@@ -50,19 +49,19 @@
5049 LRESULT OnBnClickedChkReadAuto(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
5150 LRESULT OnBnClickedBtnProcess(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
5251 LRESULT OnTabTcnSelChange(LPNMHDR pnmh);
53- LRESULT OnBtnCopyBnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl);
54- LRESULT OnBtnPasteBnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl);
5552
5653 public:
57- void SetSetting(const ProcessSetting& setting);
58- void RetrieveSetting(ProcessSetting& setting);
54+ void SetSetting(const ProcessSetting& setting, const IDataSetting* pDataSetting);
55+ void RetrieveSetting(ProcessSetting& setting, boost::shared_ptr<IDataSetting>& pDataSetting);
5956
6057 bool FetchProcessData(LPCVOID pTargetAddress, void* pWriteBuffer, size_t fetchSize);
6158
62- fastdelegate::FastDelegate1<const ProcessSetting&> m_readDelegate;
63- fastdelegate::FastDelegate1<const ProcessSetting&> m_processDelegate;
59+ fastdelegate::FastDelegate2<const ProcessSetting&, boost::shared_ptr<IDataSetting>& > m_readDelegate;
60+ fastdelegate::FastDelegate2<const ProcessSetting&, boost::shared_ptr<IDataSetting>& > m_processDelegate;
61+
62+ void CopyToClipboard();
63+ void PasteFromClipboard();
6464
65-
6665 private:
6766 CAutoCombo m_wndCmbImageName;
6867 CTabCtrl m_wndTab;
@@ -70,8 +69,6 @@
7069 boost::shared_ptr<class CSettingDialog_2D> m_pDlg2D;
7170 boost::shared_ptr<class CSettingDialog_TEXT> m_pDlgTEXT;
7271
73- boost::shared_ptr<ProcessSetting> m_pProcessSetting_Tmp;
74-
7572 void SetProcessImageNamesToComboBox();
7673 void ReadData();
7774 void ProcessData();
--- trunk/DataView.cpp (revision 13)
+++ trunk/DataView.cpp (revision 14)
@@ -109,8 +109,7 @@
109109 gl::SetupSlopeCorrectionTable(g_slopeCorrTable, SLOPE_CORR_TABLE_SIZE);
110110 gl::SetupFilterTable(g_filterTable, FILTER_TABLE_SIZE, 0.75);
111111
112- m_pSetting = boost::shared_ptr<ProcessSetting>(new ProcessSetting);
113- m_pSetting->pDataSetting = boost::shared_ptr<DataSetting1D>(new DataSetting1D);
112+ m_pDataSetting = boost::shared_ptr<DataSetting1D>(new DataSetting1D);
114113 m_scale = 1.0;
115114
116115 return 0;
@@ -167,7 +166,7 @@
167166
168167 void CDataView::Render(CPaintDC& dc)
169168 {
170- const type_info& ti = typeid(*m_pSetting->pDataSetting);
169+ const type_info& ti = typeid(*m_pDataSetting);
171170 if (ti == typeid(DataSetting1D)) {
172171 Render1D(dc);
173172 }else if (ti == typeid(DataSetting2D)) {
@@ -181,7 +180,7 @@
181180 {
182181 if (m_data.size() == 0)
183182 return;
184- const type_info& ti = typeid(*m_pSetting->pDataSetting);
183+ const type_info& ti = typeid(*m_pDataSetting);
185184 if (ti == typeid(DataSetting1D)) {
186185 ProcessAs1D();
187186 }else if (ti == typeid(DataSetting2D)) {
@@ -197,7 +196,7 @@
197196 {
198197 size_t dataBytes = m_data.size();
199198 const char* pData = &m_data[0];
200- const DataSetting1D& dataSetting = dynamic_cast<DataSetting1D&>(*m_pSetting->pDataSetting);
199+ const DataSetting1D& dataSetting = dynamic_cast<const DataSetting1D&>(*m_pDataSetting);
201200 DataReader<NumericT>::ReadDataAs(&dataSetting.GetTypeInfo(), m_values, pData, dataBytes);
202201 }
203202
@@ -206,7 +205,7 @@
206205 size_t dataBytes = m_data.size();
207206 const char* pData = &m_data[0];
208207
209- const DataSetting2D& setting = dynamic_cast<DataSetting2D&>(*m_pSetting->pDataSetting);
208+ const DataSetting2D& setting = dynamic_cast<const DataSetting2D&>(*m_pDataSetting);
210209 int width = EvalFormula(setting.widthFormula);
211210 if (width <= 0)
212211 return;
@@ -324,7 +323,7 @@
324323 return;
325324 }
326325 const std::vector<double>& values = m_values;
327- const DataSetting1D& dataSetting = dynamic_cast<DataSetting1D&>(*m_pSetting->pDataSetting);
326+ const DataSetting1D& dataSetting = dynamic_cast<const DataSetting1D&>(*m_pDataSetting);
328327 size_t dataCount = dataSetting.GetTotalBytes() / dataSetting.GetElementSize();
329328
330329 double min = 0;
@@ -461,7 +460,7 @@
461460 if (m_values.size() == 0) {
462461 return;
463462 }
464- const DataSettingTEXT& dataSetting = dynamic_cast<DataSettingTEXT&>(*m_pSetting->pDataSetting);
463+ const DataSettingTEXT& dataSetting = dynamic_cast<const DataSettingTEXT&>(*m_pDataSetting);
465464 // m_memDC.TextOut(10, 10, _T("test"), -1);
466465 size_t nBytes = dataSetting.GetTotalBytes();
467466 size_t nLines = nBytes / 16 + ((nBytes % 16) ? 1 : 0);
@@ -481,7 +480,7 @@
481480
482481 void CDataView::setScrollInfo(int hPos, int vPos)
483482 {
484- if (typeid(*m_pSetting->pDataSetting) == typeid(DataSetting2D) && m_pImage) {
483+ if (typeid(*m_pDataSetting) == typeid(DataSetting2D) && m_pImage) {
485484 BOOL bRedraw = TRUE;
486485 CSize Size;
487486 CRect rec;
@@ -520,9 +519,9 @@
520519 return 0;
521520 }
522521
523-bool FetchProcessData(const ProcessSetting& setting, std::vector<char>& data)
522+bool FetchProcessData(const ProcessSetting& setting, const boost::shared_ptr<IDataSetting>& pDataSetting, std::vector<char>& data)
524523 {
525- size_t dataLength = setting.pDataSetting->GetTotalBytes();
524+ size_t dataLength = pDataSetting->GetTotalBytes();
526525 if (dataLength == 0)
527526 return false;
528527 data.resize(dataLength);
@@ -530,12 +529,12 @@
530529
531530 int addressBase = AddressHexStrToNum(setting.addressBaseFormula);
532531 int addressOffset = EvalFormula(setting.addressOffsetFormula) * setting.addressOffsetMultiplier;
533- addressOffset += setting.pDataSetting->GetAddressOffset();
532+ addressOffset += pDataSetting->GetAddressOffset();
534533 LPCVOID pTarget = (LPVOID) (addressBase + addressOffset);
535534 bool ret = false;
536535 switch (setting.dataSourceKeyType) {
537536 case DataSourceKeyType_ImageName:
538- if (setting.imageName.IsEmpty()) {
537+ if (_tcslen(setting.imageName) == 0) {
539538 return false;
540539 }
541540 ret = ReadProcessData(setting.imageName, pTarget, buffer, dataLength);
@@ -547,10 +546,11 @@
547546 return ret;
548547 }
549548
550-void CDataView::ReadData(const ProcessSetting& setting)
549+void CDataView::ReadData(const ProcessSetting& setting, boost::shared_ptr<IDataSetting>& pDataSetting)
551550 {
552- *m_pSetting = setting;
553- if (FetchProcessData(setting, m_data)) {
551+ m_processSetting = setting;
552+ m_pDataSetting = pDataSetting;
553+ if (FetchProcessData(setting, pDataSetting, m_data)) {
554554 ProcessData();
555555 Invalidate();
556556 UpdateWindow();
@@ -557,9 +557,10 @@
557557 }
558558 }
559559
560-void CDataView::ProcessData(const ProcessSetting& setting)
560+void CDataView::ProcessData(const ProcessSetting& setting, boost::shared_ptr<IDataSetting>& pDataSetting)
561561 {
562- *m_pSetting = setting;
562+ m_processSetting = setting;
563+ m_pDataSetting = pDataSetting;
563564 ProcessData();
564565 Invalidate();
565566 UpdateWindow();
--- trunk/common/stdint.h (nonexistent)
+++ trunk/common/stdint.h (revision 14)
@@ -0,0 +1,247 @@
1+// ISO C9x compliant stdint.h for Microsoft Visual Studio
2+// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
3+//
4+// Copyright (c) 2006-2008 Alexander Chemeris
5+//
6+// Redistribution and use in source and binary forms, with or without
7+// modification, are permitted provided that the following conditions are met:
8+//
9+// 1. Redistributions of source code must retain the above copyright notice,
10+// this list of conditions and the following disclaimer.
11+//
12+// 2. Redistributions in binary form must reproduce the above copyright
13+// notice, this list of conditions and the following disclaimer in the
14+// documentation and/or other materials provided with the distribution.
15+//
16+// 3. The name of the author may be used to endorse or promote products
17+// derived from this software without specific prior written permission.
18+//
19+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
20+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
22+// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25+// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26+// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28+// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+//
30+///////////////////////////////////////////////////////////////////////////////
31+
32+#ifndef _MSC_VER // [
33+#error "Use this header only with Microsoft Visual C++ compilers!"
34+#endif // _MSC_VER ]
35+
36+#ifndef _MSC_STDINT_H_ // [
37+#define _MSC_STDINT_H_
38+
39+#if _MSC_VER > 1000
40+#pragma once
41+#endif
42+
43+#include <limits.h>
44+
45+// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
46+// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
47+// or compiler give many errors like this:
48+// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
49+#ifdef __cplusplus
50+extern "C" {
51+#endif
52+# include <wchar.h>
53+#ifdef __cplusplus
54+}
55+#endif
56+
57+// Define _W64 macros to mark types changing their size, like intptr_t.
58+#ifndef _W64
59+# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
60+# define _W64 __w64
61+# else
62+# define _W64
63+# endif
64+#endif
65+
66+
67+// 7.18.1 Integer types
68+
69+// 7.18.1.1 Exact-width integer types
70+
71+// Visual Studio 6 and Embedded Visual C++ 4 doesn't
72+// realize that, e.g. char has the same size as __int8
73+// so we give up on __intX for them.
74+#if (_MSC_VER < 1300)
75+ typedef signed char int8_t;
76+ typedef signed short int16_t;
77+ typedef signed int int32_t;
78+ typedef unsigned char uint8_t;
79+ typedef unsigned short uint16_t;
80+ typedef unsigned int uint32_t;
81+#else
82+ typedef signed __int8 int8_t;
83+ typedef signed __int16 int16_t;
84+ typedef signed __int32 int32_t;
85+ typedef unsigned __int8 uint8_t;
86+ typedef unsigned __int16 uint16_t;
87+ typedef unsigned __int32 uint32_t;
88+#endif
89+typedef signed __int64 int64_t;
90+typedef unsigned __int64 uint64_t;
91+
92+
93+// 7.18.1.2 Minimum-width integer types
94+typedef int8_t int_least8_t;
95+typedef int16_t int_least16_t;
96+typedef int32_t int_least32_t;
97+typedef int64_t int_least64_t;
98+typedef uint8_t uint_least8_t;
99+typedef uint16_t uint_least16_t;
100+typedef uint32_t uint_least32_t;
101+typedef uint64_t uint_least64_t;
102+
103+// 7.18.1.3 Fastest minimum-width integer types
104+typedef int8_t int_fast8_t;
105+typedef int16_t int_fast16_t;
106+typedef int32_t int_fast32_t;
107+typedef int64_t int_fast64_t;
108+typedef uint8_t uint_fast8_t;
109+typedef uint16_t uint_fast16_t;
110+typedef uint32_t uint_fast32_t;
111+typedef uint64_t uint_fast64_t;
112+
113+// 7.18.1.4 Integer types capable of holding object pointers
114+#ifdef _WIN64 // [
115+ typedef signed __int64 intptr_t;
116+ typedef unsigned __int64 uintptr_t;
117+#else // _WIN64 ][
118+ typedef _W64 signed int intptr_t;
119+ typedef _W64 unsigned int uintptr_t;
120+#endif // _WIN64 ]
121+
122+// 7.18.1.5 Greatest-width integer types
123+typedef int64_t intmax_t;
124+typedef uint64_t uintmax_t;
125+
126+
127+// 7.18.2 Limits of specified-width integer types
128+
129+#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
130+
131+// 7.18.2.1 Limits of exact-width integer types
132+#define INT8_MIN ((int8_t)_I8_MIN)
133+#define INT8_MAX _I8_MAX
134+#define INT16_MIN ((int16_t)_I16_MIN)
135+#define INT16_MAX _I16_MAX
136+#define INT32_MIN ((int32_t)_I32_MIN)
137+#define INT32_MAX _I32_MAX
138+#define INT64_MIN ((int64_t)_I64_MIN)
139+#define INT64_MAX _I64_MAX
140+#define UINT8_MAX _UI8_MAX
141+#define UINT16_MAX _UI16_MAX
142+#define UINT32_MAX _UI32_MAX
143+#define UINT64_MAX _UI64_MAX
144+
145+// 7.18.2.2 Limits of minimum-width integer types
146+#define INT_LEAST8_MIN INT8_MIN
147+#define INT_LEAST8_MAX INT8_MAX
148+#define INT_LEAST16_MIN INT16_MIN
149+#define INT_LEAST16_MAX INT16_MAX
150+#define INT_LEAST32_MIN INT32_MIN
151+#define INT_LEAST32_MAX INT32_MAX
152+#define INT_LEAST64_MIN INT64_MIN
153+#define INT_LEAST64_MAX INT64_MAX
154+#define UINT_LEAST8_MAX UINT8_MAX
155+#define UINT_LEAST16_MAX UINT16_MAX
156+#define UINT_LEAST32_MAX UINT32_MAX
157+#define UINT_LEAST64_MAX UINT64_MAX
158+
159+// 7.18.2.3 Limits of fastest minimum-width integer types
160+#define INT_FAST8_MIN INT8_MIN
161+#define INT_FAST8_MAX INT8_MAX
162+#define INT_FAST16_MIN INT16_MIN
163+#define INT_FAST16_MAX INT16_MAX
164+#define INT_FAST32_MIN INT32_MIN
165+#define INT_FAST32_MAX INT32_MAX
166+#define INT_FAST64_MIN INT64_MIN
167+#define INT_FAST64_MAX INT64_MAX
168+#define UINT_FAST8_MAX UINT8_MAX
169+#define UINT_FAST16_MAX UINT16_MAX
170+#define UINT_FAST32_MAX UINT32_MAX
171+#define UINT_FAST64_MAX UINT64_MAX
172+
173+// 7.18.2.4 Limits of integer types capable of holding object pointers
174+#ifdef _WIN64 // [
175+# define INTPTR_MIN INT64_MIN
176+# define INTPTR_MAX INT64_MAX
177+# define UINTPTR_MAX UINT64_MAX
178+#else // _WIN64 ][
179+# define INTPTR_MIN INT32_MIN
180+# define INTPTR_MAX INT32_MAX
181+# define UINTPTR_MAX UINT32_MAX
182+#endif // _WIN64 ]
183+
184+// 7.18.2.5 Limits of greatest-width integer types
185+#define INTMAX_MIN INT64_MIN
186+#define INTMAX_MAX INT64_MAX
187+#define UINTMAX_MAX UINT64_MAX
188+
189+// 7.18.3 Limits of other integer types
190+
191+#ifdef _WIN64 // [
192+# define PTRDIFF_MIN _I64_MIN
193+# define PTRDIFF_MAX _I64_MAX
194+#else // _WIN64 ][
195+# define PTRDIFF_MIN _I32_MIN
196+# define PTRDIFF_MAX _I32_MAX
197+#endif // _WIN64 ]
198+
199+#define SIG_ATOMIC_MIN INT_MIN
200+#define SIG_ATOMIC_MAX INT_MAX
201+
202+#ifndef SIZE_MAX // [
203+# ifdef _WIN64 // [
204+# define SIZE_MAX _UI64_MAX
205+# else // _WIN64 ][
206+# define SIZE_MAX _UI32_MAX
207+# endif // _WIN64 ]
208+#endif // SIZE_MAX ]
209+
210+// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
211+#ifndef WCHAR_MIN // [
212+# define WCHAR_MIN 0
213+#endif // WCHAR_MIN ]
214+#ifndef WCHAR_MAX // [
215+# define WCHAR_MAX _UI16_MAX
216+#endif // WCHAR_MAX ]
217+
218+#define WINT_MIN 0
219+#define WINT_MAX _UI16_MAX
220+
221+#endif // __STDC_LIMIT_MACROS ]
222+
223+
224+// 7.18.4 Limits of other integer types
225+
226+#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
227+
228+// 7.18.4.1 Macros for minimum-width integer constants
229+
230+#define INT8_C(val) val##i8
231+#define INT16_C(val) val##i16
232+#define INT32_C(val) val##i32
233+#define INT64_C(val) val##i64
234+
235+#define UINT8_C(val) val##ui8
236+#define UINT16_C(val) val##ui16
237+#define UINT32_C(val) val##ui32
238+#define UINT64_C(val) val##ui64
239+
240+// 7.18.4.2 Macros for greatest-width integer constants
241+#define INTMAX_C INT64_C
242+#define UINTMAX_C UINT64_C
243+
244+#endif // __STDC_CONSTANT_MACROS ]
245+
246+
247+#endif // _MSC_STDINT_H_ ]
--- trunk/common/arrayutil.h (revision 13)
+++ trunk/common/arrayutil.h (revision 14)
@@ -1,8 +1,5 @@
11 #pragma once
22
3-#include <boost/cstdint.hpp>
4-using namespace boost;
5-
63 template <typename T>
74 bool InArray(const T& val, const T arr[])
85 {
--- trunk/common/gl/buffer2d_bit.h (revision 13)
+++ trunk/common/gl/buffer2d_bit.h (revision 14)
@@ -1,7 +1,6 @@
11 #pragma once
22
33 #include "buffer2D.h"
4-#include <boost/cstdint.hpp>
54
65 namespace gl
76 {
@@ -11,7 +10,7 @@
1110 class Buffer2D<bool> : public IBuffer2D
1211 {
1312 public:
14- typedef boost::uint_fast32_t value_type;
13+ typedef uint32_t value_type;
1514 private:
1615 size_t width_; //!< 描画領域の横幅
1716 size_t height_; //!< 描画領域の縦幅
--- trunk/Setting.cpp (revision 13)
+++ trunk/Setting.cpp (revision 14)
@@ -7,6 +7,9 @@
77 {
88 dataType = DataType_Int;
99 viewAuto = true;
10+ _tcscpy(countFormula, _T(""));
11+ _tcscpy(viewMinFormula, _T(""));
12+ _tcscpy(viewMaxFormula, _T(""));
1013 }
1114
1215 std::map<DataSetting1D::DataType, const std::type_info*> typeInfoMap;
@@ -64,7 +67,9 @@
6467 ProcessSetting::ProcessSetting()
6568 {
6669 dataSourceKeyType = DataSourceKeyType_ImageName;
67- imageName = "";
70+ _tcscpy(imageName, _T(""));
71+ _tcscpy(addressBaseFormula, _T(""));
72+ _tcscpy(addressOffsetFormula, _T(""));
6873 pid = 0;
6974 addressOffsetMultiplier = 1;
7075 }
--- trunk/SettingDialog_1D.cpp (revision 13)
+++ trunk/SettingDialog_1D.cpp (revision 14)
@@ -4,6 +4,7 @@
44
55 #include "converter.h"
66 #include "Setting.h"
7+#include "arrayutil.h"
78
89 #include "TwoWayMap.h"
910
@@ -67,10 +68,10 @@
6768 CString str;
6869 m_wndCmbType.GetLBText(m_wndCmbType.GetCurSel(), str);
6970 setting.dataType = dataTypeMapper[str];
70- GetDlgItemText(IDC_EDT_COUNT, setting.countFormula);
71+ GetDlgItemText(IDC_EDT_COUNT, setting.countFormula, Count(setting.countFormula));
7172 setting.viewAuto = (IsDlgButtonChecked(IDC_CHK_VIEWAUTO) == BST_CHECKED);
72- GetDlgItemText(IDC_EDT_VIEW_MIN, setting.viewMinFormula);
73- GetDlgItemText(IDC_EDT_VIEW_MAX, setting.viewMaxFormula);
73+ GetDlgItemText(IDC_EDT_VIEW_MIN, setting.viewMinFormula, Count(setting.viewMinFormula));
74+ GetDlgItemText(IDC_EDT_VIEW_MAX, setting.viewMaxFormula, Count(setting.viewMaxFormula));
7475 }catch(...) {
7576 ;
7677 }
@@ -79,9 +80,9 @@
7980
8081 void CSettingDialog_1D::RetrieveSetting(boost::shared_ptr<IDataSetting>& pSetting)
8182 {
82- boost::shared_ptr<DataSetting1D> ps = boost::shared_ptr<DataSetting1D>(new DataSetting1D);
83- RetreiveSetting(*ps);
84- pSetting = ps;
83+ DataSetting1D* p = new DataSetting1D();
84+ RetreiveSetting(*p);
85+ pSetting = boost::shared_ptr<DataSetting1D>(p);
8586 }
8687
8788 LRESULT CSettingDialog_1D::OnBnClickedChkViewauto(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
--- trunk/ChildFrm.cpp (revision 13)
+++ trunk/ChildFrm.cpp (revision 14)
@@ -57,7 +57,7 @@
5757 ::DrawMenuBar(GetMainFrame());
5858
5959 m_pMainFrame->m_pCurView = m_pView.get();
60- m_pMainFrame->SetSettingView(m_pView->GetSetting());
60+ m_pMainFrame->SetSettingView(m_pView->GetProcessSetting(), m_pView->GetDataSetting());
6161 }
6262 else if((HWND)lParam == NULL) { // last child has closed
6363 m_pMainFrame->m_pCurView = NULL;
--- trunk/MainFrm.cpp (revision 13)
+++ trunk/MainFrm.cpp (revision 14)
@@ -192,27 +192,27 @@
192192 return 0;
193193 }
194194
195-void CMainFrame::SetSettingView(const ProcessSetting& setting)
195+void CMainFrame::SetSettingView(const ProcessSetting& setting, const IDataSetting* pDataSetting)
196196 {
197- m_pSettingDlg->SetSetting(setting);
197+ m_pSettingDlg->SetSetting(setting, pDataSetting);
198198
199199 }
200200
201-void CMainFrame::ReadData(const ProcessSetting& setting)
201+void CMainFrame::ReadData(const ProcessSetting& setting, boost::shared_ptr<IDataSetting>& pDataSetting)
202202 {
203203 if (!m_pCurView)
204204 return;
205205
206- m_pCurView->ReadData(setting);
206+ m_pCurView->ReadData(setting, pDataSetting);
207207
208208 }
209209
210-void CMainFrame::ProcessData(const ProcessSetting& setting)
210+void CMainFrame::ProcessData(const ProcessSetting& setting, boost::shared_ptr<IDataSetting>& pDataSetting)
211211 {
212212 if (!m_pCurView)
213213 return;
214214
215- m_pCurView->ProcessData(setting);
215+ m_pCurView->ProcessData(setting, pDataSetting);
216216
217217 }
218218
@@ -235,3 +235,15 @@
235235 updateUI();
236236 return 0;
237237 }
238+
239+LRESULT CMainFrame::OnEditCopy(WORD wNotifyCode, WORD wID, HWND hWndCtl)
240+{
241+ m_pSettingDlg->CopyToClipboard();
242+ return 0;
243+}
244+
245+LRESULT CMainFrame::OnEditPaste(WORD wNotifyCode, WORD wID, HWND hWndCtl)
246+{
247+ m_pSettingDlg->PasteFromClipboard();
248+ return 0;
249+}
--- trunk/SettingDialog.cpp (revision 13)
+++ trunk/SettingDialog.cpp (revision 14)
@@ -3,6 +3,7 @@
33
44 #include "converter.h"
55 #include "Setting.h"
6+#include "arrayutil.h"
67
78 #include "SettingDialog_1D.h"
89 #include "SettingDialog_2D.h"
@@ -23,8 +24,12 @@
2324 {
2425 }
2526
27+static UINT clipBoardFormat_;
28+
2629 LRESULT CSettingDialog::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
2730 {
31+ clipBoardFormat_ = RegisterClipboardFormat(_T("beruponu DataViewer"));
32+
2833 DoDataExchange();
2934 // SetSetting();
3035
@@ -91,7 +96,7 @@
9196 return FALSE;
9297 }
9398
94-void CSettingDialog::SetSetting(const ProcessSetting& setting)
99+void CSettingDialog::SetSetting(const ProcessSetting& setting, const IDataSetting* pDataSetting)
95100 {
96101 switch (setting.dataSourceKeyType) {
97102 case DataSourceKeyType_ImageName:
@@ -111,18 +116,18 @@
111116 SetDlgItemText(IDC_EDT_ADDRESS_OFFSET, setting.addressOffsetFormula);
112117 convert(setting.addressOffsetMultiplier, str); SetDlgItemText(IDC_EDT_ADDRESS_OFFSET_MULTIPLIER, str);
113118
114- assert (setting.pDataSetting);
115- const type_info& dataType = typeid(*setting.pDataSetting);
119+ assert (pDataSetting);
120+ const type_info& dataType = typeid(*pDataSetting);
116121 if (dataType == typeid(DataSetting1D)) {
117- m_pDlg1D->SetSetting(dynamic_cast<const DataSetting1D&>(*setting.pDataSetting));
122+ m_pDlg1D->SetSetting(dynamic_cast<const DataSetting1D&>(*pDataSetting));
118123 m_wndTab.SetCurSel(0);
119124 OnSelTab(0);
120125 }else if (dataType == typeid(DataSetting2D)) {
121- m_pDlg2D->SetSetting(dynamic_cast<const DataSetting2D&>(*setting.pDataSetting));
126+ m_pDlg2D->SetSetting(dynamic_cast<const DataSetting2D&>(*pDataSetting));
122127 m_wndTab.SetCurSel(1);
123128 OnSelTab(1);
124129 }else {
125- m_pDlgTEXT->SetSetting(dynamic_cast<const DataSettingTEXT&>(*setting.pDataSetting));
130+ m_pDlgTEXT->SetSetting(dynamic_cast<const DataSettingTEXT&>(*pDataSetting));
126131 m_wndTab.SetCurSel(2);
127132 OnSelTab(2);
128133 }
@@ -150,7 +155,7 @@
150155 }
151156 }
152157
153-void CSettingDialog::RetrieveSetting(ProcessSetting& setting)
158+void CSettingDialog::RetrieveSetting(ProcessSetting& setting, boost::shared_ptr<IDataSetting>& pDataSetting)
154159 {
155160 try {
156161
@@ -162,22 +167,22 @@
162167 setting.dataSourceKeyType = DataSourceKeyType_PID;
163168 }
164169
165- m_wndCmbImageName.GetWindowText(setting.imageName);
170+ m_wndCmbImageName.GetWindowText(setting.imageName, Count(setting.imageName));
166171 GetDlgItemText(IDC_EDT_PID, str);
167172 convert(str, setting.pid);
168173
169- GetDlgItemText(IDC_EDT_ADDRESS_BASE, setting.addressBaseFormula);
170- GetDlgItemText(IDC_EDT_ADDRESS_OFFSET, setting.addressOffsetFormula);
174+ GetDlgItemText(IDC_EDT_ADDRESS_BASE, setting.addressBaseFormula, Count(setting.addressBaseFormula));
175+ GetDlgItemText(IDC_EDT_ADDRESS_OFFSET, setting.addressOffsetFormula, Count(setting.addressOffsetFormula));
171176
172177 GetDlgItemText(IDC_EDT_ADDRESS_OFFSET_MULTIPLIER, str);
173178 convert(str, setting.addressOffsetMultiplier);
174179
175180 if (m_pDlg1D->IsWindowVisible()) {
176- m_pDlg1D->RetrieveSetting(setting.pDataSetting);
181+ m_pDlg1D->RetrieveSetting(pDataSetting);
177182 }else if (m_pDlg2D->IsWindowVisible()) {
178- m_pDlg2D->RetrieveSetting(setting.pDataSetting);
183+ m_pDlg2D->RetrieveSetting(pDataSetting);
179184 }else {
180- m_pDlgTEXT->RetrieveSetting(setting.pDataSetting);
185+ m_pDlgTEXT->RetrieveSetting(pDataSetting);
181186 }
182187
183188 }catch(...) {
@@ -257,21 +262,6 @@
257262 return false;
258263 }
259264
260-LRESULT CSettingDialog::OnBtnCopyBnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl)
261-{
262- m_pProcessSetting_Tmp = boost::shared_ptr<ProcessSetting>(new ProcessSetting);
263- RetrieveSetting(*m_pProcessSetting_Tmp);
264- return 0;
265-}
266-
267-LRESULT CSettingDialog::OnBtnPasteBnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl)
268-{
269- if (m_pProcessSetting_Tmp) {
270- SetSetting(*m_pProcessSetting_Tmp);
271- }
272- return 0;
273-}
274-
275265 LRESULT CSettingDialog::OnBnClickedBtnRead(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
276266 {
277267 ReadData();
@@ -299,8 +289,9 @@
299289 {
300290 if (m_readDelegate) {
301291 ProcessSetting setting;
302- RetrieveSetting(setting);
303- m_readDelegate(setting);
292+ boost::shared_ptr<IDataSetting> pDataSetting;
293+ RetrieveSetting(setting, pDataSetting);
294+ m_readDelegate(setting, pDataSetting);
304295 }
305296 }
306297
@@ -308,8 +299,45 @@
308299 {
309300 if (m_processDelegate) {
310301 ProcessSetting setting;
311- RetrieveSetting(setting);
312- m_processDelegate(setting);
302+ boost::shared_ptr<IDataSetting> pDataSetting;
303+ RetrieveSetting(setting, pDataSetting);
304+ m_processDelegate(setting, pDataSetting);
313305 }
314306 }
315307
308+void CSettingDialog::CopyToClipboard()
309+{
310+ if (!OpenClipboard()) {
311+ return;
312+ }
313+ EmptyClipboard();
314+ HGLOBAL hG = GlobalAlloc(GHND, sizeof(ProcessSetting) + sizeof(DataSetting2D));
315+ uint8_t* mem = (uint8_t*) GlobalLock(hG);
316+
317+ ProcessSetting processSetting;
318+ boost::shared_ptr<IDataSetting> pDataSetting;
319+ RetrieveSetting(processSetting, pDataSetting);
320+ memcpy(mem, &processSetting, sizeof(processSetting));
321+ memcpy(mem+sizeof(processSetting), pDataSetting.get(), sizeof(DataSetting2D));
322+
323+ GlobalUnlock(mem);
324+ SetClipboardData(clipBoardFormat_, hG);
325+ CloseClipboard();
326+}
327+
328+void CSettingDialog::PasteFromClipboard()
329+{
330+ if (!OpenClipboard()) {
331+ return;
332+ }
333+ HANDLE hClip = GetClipboardData(clipBoardFormat_);
334+ if (!hClip) {
335+ CloseClipboard();
336+ return;
337+ }
338+ const uint8_t* mem = (const uint8_t*) GlobalLock(hClip);
339+ SetSetting(*(const ProcessSetting*)mem, (const IDataSetting*)(mem+sizeof(ProcessSetting)));
340+ GlobalUnlock(hClip);
341+ CloseClipboard();
342+}
343+
Afficher sur ancien navigateur de dépôt.