rhodes 3.3.2.beta.1 → 3.3.2.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +5 -5
- data/Rakefile +1 -1
- data/doc/build.txt +27 -1
- data/doc/device-caps.txt +65 -18
- data/doc/install.txt +5 -3
- data/lib/extensions/barcode/ext/barcode/platform/wm/Barcode.sln +30 -0
- data/lib/extensions/barcode/ext/barcode/platform/wm/Barcode.vcproj +159 -5
- data/lib/extensions/barcode/ext/barcode/platform/wm/Rakefile +1 -1
- data/lib/extensions/digest-md5/ext/Rakefile +2 -2
- data/lib/extensions/digest-md5/ext/digest-md5.sln +44 -0
- data/lib/extensions/digest-sha1/ext/Rakefile +2 -2
- data/lib/extensions/digest-sha1/ext/digest-sha1.sln +44 -0
- data/lib/framework/rho/rhofsconnector.rb +9 -6
- data/lib/framework/rhom/rhom_db_adapter.rb +10 -0
- data/platform/android/Rhodes/jni/src/logconf.cpp +5 -0
- data/platform/android/Rhodes/jni/src/rhodesapp.cpp +7 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +82 -37
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoLogConf.java +2 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +8 -9
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +87 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +77 -159
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SplashScreen.java +4 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/GoogleMapView.java +6 -31
- data/platform/iphone/Classes/AppManager/AppManager.m +106 -29
- data/platform/iphone/Classes/Rhodes.m +27 -0
- data/platform/iphone/rbuild/iphone.rake +1 -1
- data/platform/shared/common/RhodesApp.cpp +10 -2
- data/platform/shared/common/RhodesAppBase.cpp +20 -4
- data/platform/shared/common/RhodesAppBase.h +4 -0
- data/platform/shared/db/DBAdapter.cpp +4 -6
- data/platform/shared/logging/RhoLogConf.cpp +2 -7
- data/platform/shared/logging/RhoLogConf.h +4 -0
- data/platform/shared/net/HttpServer.cpp +2 -2
- data/platform/shared/net/RawSocket.cpp +3 -0
- data/platform/shared/ruby/ext/rho/rhoruby.c +7 -3
- data/platform/shared/ruby/ext/rho/rhoruby.h +2 -1
- data/platform/shared/ruby/ext/rho/rhosupport.c +9 -3
- data/platform/shared/ruby/ext/system/system.i +4 -0
- data/platform/shared/ruby/ext/system/system_wrap.c +40 -1
- data/platform/wm/build/wm.rake +15 -5
- data/platform/wm/rhodes/LogView.cpp +25 -1
- data/platform/wm/rhodes/LogView.h +13 -0
- data/platform/wm/rhodes/MainWindow.cpp +4 -0
- data/platform/wm/rhodes/Rhodes.cpp +1 -1
- data/platform/wm/rhodes/rho/rubyext/RhoSignature.cpp +240 -145
- data/platform/wm/rhodes/rho/rubyext/RhoSignature.h +24 -5
- data/platform/wm/rhodes/rho/rubyext/calendar.cpp +8 -1
- data/platform/wm/tools/detool/detool.cpp +88 -7
- data/platform/wm/tools/detool/detool.vcproj +2 -2
- data/platform/wm/tools/detool/stdafx.h +1 -0
- data/platform/wp7/RhoRubyExtGen/RhoSyncEngine.cs +2 -2
- data/platform/wp7/RhoRubyLib/Initializers.Generated.cs +4 -4
- data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +8 -3
- data/platform/wp7/RhoRubyLib/net/HttpServer.cs +25 -6
- data/platform/wp7/RhoRubyLib/net/NetRequest.cs +1 -1
- data/platform/wp7/RhoRubyLib/rubyext/RhoSyncEngine.cs +23 -13
- data/platform/wp7/RhoRubyLib/sync/SyncProtocol_3.cs +6 -1
- data/platform/wp7/RhoRubyLib/views/RhoView.xaml.cs +33 -2
- data/platform/wp7/build/wp.rake +52 -0
- data/rakefile.rb +1 -1
- data/res/build-tools/detool.exe +0 -0
- data/res/generators/rhogen.rb +5 -0
- data/res/generators/templates/application/app/Settings/controller.rb +1 -1
- data/res/generators/templates/application/app/Settings/err_sync.erb +11 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/Montana.sln +22 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/Rakefile +2 -2
- data/spec/phone_spec/app/SpecRunner/index.erb +0 -1
- data/spec/phone_spec/app/spec/asynchttp_spec.rb +1 -11
- data/spec/phone_spec/app/spec/blobsync_spec.rb +7 -2
- data/spec/phone_spec/app/spec/date_spec.rb +1 -1
- data/spec/phone_spec/app/spec/json_spec.rb +0 -3
- data/spec/phone_spec/app/spec/syncengine_spec.rb +6 -2
- data/spec/phone_spec/app/spec_runner.rb +10 -7
- data/version +1 -1
- metadata +9 -9
- data/platform/wm/tools/wmdc_connect/stdafx.cpp +0 -27
- data/platform/wm/tools/wmdc_connect/stdafx.h +0 -35
- data/platform/wm/tools/wmdc_connect/wmdc_connect.cpp +0 -119
- data/platform/wm/tools/wmdc_connect/wmdc_connect.vcproj +0 -205
- data/platform/wm/tools/wmdc_connect.sln +0 -20
data/platform/wm/build/wm.rake
CHANGED
@@ -89,7 +89,7 @@ namespace "config" do
|
|
89
89
|
$log_file = $app_config["applog"].nil? ? "applog.txt" : $app_config["applog"]
|
90
90
|
$srcdir = $bindir + "/RhoBundle"
|
91
91
|
$buildcfg = $app_config["buildcfg"]
|
92
|
-
$buildcfg = "Release"
|
92
|
+
$buildcfg = "Release" unless $buildcfg
|
93
93
|
|
94
94
|
if $sdk == "Windows Mobile 6 Professional SDK (ARMV4I)"
|
95
95
|
$targetdir = $bindir + "/target/wm6p"
|
@@ -150,7 +150,7 @@ namespace "build" do
|
|
150
150
|
next unless File.exists? File.join(extpath, "build.bat")
|
151
151
|
|
152
152
|
ENV['RHO_PLATFORM'] = $current_platform
|
153
|
-
ENV['RHO_BUILD_CONFIG'] = '
|
153
|
+
ENV['RHO_BUILD_CONFIG'] = 'Release'
|
154
154
|
ENV['PWD'] = $startdir
|
155
155
|
ENV['RHO_ROOT'] = ENV['PWD']
|
156
156
|
|
@@ -225,11 +225,18 @@ namespace "build" do
|
|
225
225
|
#task :rhobundle => ["config:wm", "build:bundle:noxruby", "build:wm:extensions"] do
|
226
226
|
#end
|
227
227
|
|
228
|
-
task :
|
228
|
+
task :rhobundle => ["config:set_win32_platform", "build:wm:rhobundle", :after_bundle] do
|
229
|
+
end
|
230
|
+
|
231
|
+
task :set_debug_config do
|
232
|
+
$buildcfg = 'debug'
|
233
|
+
end
|
234
|
+
|
235
|
+
task :devrhobundle => ["config:set_win32_platform", :set_debug_config, "build:wm:rhobundle", :after_bundle] do
|
229
236
|
end
|
230
237
|
|
231
238
|
task :after_bundle do
|
232
|
-
win32rhopath = 'platform/wm/bin/win32/rhodes/'+ $buildcfg + '/rho/'
|
239
|
+
win32rhopath = 'platform/wm/bin/win32/rhodes/' + $buildcfg + '/rho/'
|
233
240
|
mkdir_p win32rhopath
|
234
241
|
namepath = File.join(win32rhopath,"name.txt")
|
235
242
|
old_appname = File.read(namepath) if File.exists?(namepath)
|
@@ -301,7 +308,7 @@ namespace "build" do
|
|
301
308
|
end
|
302
309
|
|
303
310
|
#desc "Build rhodes for win32"
|
304
|
-
task :win32 => ["build:win32:
|
311
|
+
task :win32 => ["build:win32:rhobundle"] do
|
305
312
|
chdir $config["build"]["wmpath"]
|
306
313
|
|
307
314
|
args = ['/M4', $build_solution, "\"" + $buildcfg + '|win32"']
|
@@ -624,6 +631,9 @@ namespace "run" do
|
|
624
631
|
|
625
632
|
namespace "win32" do
|
626
633
|
task :delete_db do
|
634
|
+
$buildcfg = $app_config["buildcfg"]
|
635
|
+
$buildcfg = "Release" unless $buildcfg
|
636
|
+
|
627
637
|
db_path = 'platform/wm/bin/win32/rhodes/' + $buildcfg + '/rho/db'
|
628
638
|
rm_rf db_path if File.exists?(db_path)
|
629
639
|
end
|
@@ -53,7 +53,7 @@ LRESULT CLogView::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
|
53
53
|
mbi.nToolBarId = IDR_LOGMENUBAR; // ID of toolbar resource
|
54
54
|
mbi.hInstRes = _AtlBaseModule.GetResourceInstance();
|
55
55
|
mbi.dwFlags = SHCMBF_HMENU;
|
56
|
-
|
56
|
+
SHCreateMenuBar(&mbi);
|
57
57
|
|
58
58
|
// SendDlgItemMessage(IDC_LOGEDIT,WM_SETFONT, (WPARAM)GetStockObject(SYSTEM_FONT),0);
|
59
59
|
|
@@ -297,6 +297,30 @@ LRESULT CLogView::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandl
|
|
297
297
|
|
298
298
|
#endif //OS_WINDOWS
|
299
299
|
|
300
|
+
|
301
|
+
#ifdef OS_WINCE
|
302
|
+
LRESULT CLogView::OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
|
303
|
+
{
|
304
|
+
EndDialog(IDCANCEL);
|
305
|
+
bHandled = TRUE;
|
306
|
+
return 0;
|
307
|
+
}
|
308
|
+
|
309
|
+
LRESULT CLogView::OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
|
310
|
+
{
|
311
|
+
EndDialog(wID);
|
312
|
+
bHandled = TRUE;
|
313
|
+
return 0;
|
314
|
+
}
|
315
|
+
|
316
|
+
LRESULT CLogView::OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
|
317
|
+
{
|
318
|
+
EndDialog(wID);
|
319
|
+
bHandled = TRUE;
|
320
|
+
return 0;
|
321
|
+
}
|
322
|
+
#endif
|
323
|
+
|
300
324
|
LRESULT CLogView::OnBack(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
|
301
325
|
{
|
302
326
|
EndDialog(wID);
|
@@ -139,6 +139,13 @@ BEGIN_MSG_MAP(CLogView)
|
|
139
139
|
COMMAND_ID_HANDLER(IDM_SENDLOG, OnSendLog)
|
140
140
|
COMMAND_ID_HANDLER(IDM_REFRESH, OnRefresh)
|
141
141
|
COMMAND_ID_HANDLER(IDM_CLEAR, OnClear)
|
142
|
+
|
143
|
+
#ifdef OS_WINCE
|
144
|
+
COMMAND_ID_HANDLER(IDOK, OnOK)
|
145
|
+
COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
|
146
|
+
MESSAGE_HANDLER(WM_CLOSE,OnClose)
|
147
|
+
#endif
|
148
|
+
|
142
149
|
END_MSG_MAP()
|
143
150
|
// CHAIN_MSG_MAP(CAxDialogImpl<CLogView>)
|
144
151
|
|
@@ -155,6 +162,12 @@ END_MSG_MAP()
|
|
155
162
|
LRESULT OnRefresh(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
|
156
163
|
LRESULT OnClear(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
|
157
164
|
|
165
|
+
#ifdef OS_WINCE
|
166
|
+
LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
|
167
|
+
LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
|
168
|
+
LRESULT OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
169
|
+
#endif
|
170
|
+
|
158
171
|
LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
159
172
|
LRESULT OnCtlColor(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
160
173
|
#if defined(OS_WINDOWS)
|
@@ -810,10 +810,14 @@ LRESULT CMainWindow::OnAlertShowPopup (UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
|
|
810
810
|
}
|
811
811
|
}else if (params->m_dlgType == CAlertDialog::Params::DLG_DEFAULT) {
|
812
812
|
MessageBox(convertToStringW(params->m_message).c_str(), strAppName.c_str(), MB_ICONWARNING | MB_OK);
|
813
|
+
RHODESAPP().callPopupCallback(params->m_callback, "ok", "ok");
|
813
814
|
} else if (params->m_dlgType == CAlertDialog::Params::DLG_CUSTOM)
|
814
815
|
{
|
815
816
|
if ( params->m_buttons.size() == 1 && strcasecmp(params->m_buttons[0].m_strCaption.c_str(), "ok") == 0)
|
817
|
+
{
|
816
818
|
MessageBox(convertToStringW(params->m_message).c_str(), convertToStringW(params->m_title).c_str(), MB_ICONWARNING | MB_OK);
|
819
|
+
RHODESAPP().callPopupCallback(params->m_callback, params->m_buttons[0].m_strID, params->m_buttons[0].m_strCaption);
|
820
|
+
}
|
817
821
|
else if (params->m_buttons.size() == 2 && strcasecmp(params->m_buttons[0].m_strCaption.c_str(), "ok") == 0 &&
|
818
822
|
strcasecmp(params->m_buttons[1].m_strCaption.c_str(), "cancel") == 0)
|
819
823
|
{
|
@@ -167,7 +167,7 @@ bool CRhodesModule::ParseCommandLine(LPCTSTR lpCmdLine, HRESULT* pnRetCode ) thr
|
|
167
167
|
LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens);
|
168
168
|
getRhoRootPath();
|
169
169
|
|
170
|
-
m_logPort =
|
170
|
+
m_logPort = "";
|
171
171
|
|
172
172
|
while (lpszToken != NULL)
|
173
173
|
{
|
@@ -6,14 +6,9 @@
|
|
6
6
|
#include "common/RhoFilePath.h"
|
7
7
|
#include "common/app_build_capabilities.h"
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
#endif
|
13
|
-
|
14
|
-
#if defined(_WIN32_WCE)
|
15
|
-
#include <imaging.h>
|
16
|
-
#endif
|
9
|
+
//#if defined(_WIN32_WCE)
|
10
|
+
//#include <imaging.h>
|
11
|
+
//#endif
|
17
12
|
|
18
13
|
#ifdef APP_BUILD_CAPABILITY_WEBKIT_BROWSER
|
19
14
|
extern void *rho_wmimpl_createSignatureInstance(HINSTANCE hInst, HWND hWnd, RECT rcWnd, int bgColor, int penColor, int penWidth);
|
@@ -24,6 +19,7 @@ extern BOOL rho_wmimpl_saveSignature(void *inkImpl, LPCTSTR szFilePathName);
|
|
24
19
|
#endif
|
25
20
|
|
26
21
|
extern "C" HWND getMainWnd();
|
22
|
+
extern "C" HWND getWebViewWnd(int index);
|
27
23
|
|
28
24
|
namespace rho
|
29
25
|
{
|
@@ -57,7 +53,7 @@ CRhoSignature::~CRhoSignature(void)
|
|
57
53
|
if (oSigParams.m_bVisible)
|
58
54
|
{
|
59
55
|
m_pSigWindow = new CRhoSignatureWindow(params);
|
60
|
-
m_pSigWindow->Create(
|
56
|
+
m_pSigWindow->Create(getWebViewWnd(0));
|
61
57
|
m_pSigWindow->ShowWindow(SW_SHOW);
|
62
58
|
|
63
59
|
}else
|
@@ -99,29 +95,11 @@ CRhoSignature::~CRhoSignature(void)
|
|
99
95
|
|
100
96
|
LRESULT CRhoSignatureWindow::OnDestroyDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
|
101
97
|
{
|
102
|
-
#ifdef APP_BUILD_CAPABILITY_WEBKIT_BROWSER
|
103
|
-
|
104
|
-
if (m_pInkImpl != NULL )
|
105
|
-
{
|
106
|
-
rho_wmimpl_deleteSignature(m_pInkImpl);
|
107
|
-
}
|
108
|
-
#else
|
109
|
-
|
110
|
-
#if defined(_WIN32_WCE) && !defined( OS_PLATFORM_MOTCE )
|
111
|
-
if (m_pInkImpl != NULL)
|
112
|
-
{
|
113
|
-
((IInkOverlay*)m_pInkImpl)->Release();
|
114
|
-
}
|
115
|
-
#endif
|
116
|
-
|
117
|
-
#endif
|
118
|
-
|
119
98
|
if ( m_hWndCommandBar )
|
120
99
|
::DestroyWindow(m_hWndCommandBar);
|
121
100
|
|
122
101
|
m_hWndCommandBar = 0;
|
123
102
|
|
124
|
-
m_pInkImpl = NULL;
|
125
103
|
return FALSE;
|
126
104
|
}
|
127
105
|
|
@@ -166,51 +144,6 @@ LRESULT CRhoSignatureWindow::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPAR
|
|
166
144
|
|
167
145
|
}
|
168
146
|
|
169
|
-
#ifdef APP_BUILD_CAPABILITY_WEBKIT_BROWSER
|
170
|
-
//CSignature* pRESig = new CSignature(_AtlBaseModule.GetResourceInstance(), getMainWnd(), 0, 0);
|
171
|
-
//pRESig->RhoInitialise(m_hWnd, rcWnd, getParams().getBgColor(), getParams().getPenColor(), getParams().getPenWidth());
|
172
|
-
m_pInkImpl = rho_wmimpl_createSignatureInstance(_AtlBaseModule.GetResourceInstance(), m_hWnd, (RECT)rcWnd,
|
173
|
-
getParams().getBgColor(), getParams().getPenColor(), getParams().getPenWidth());
|
174
|
-
#elif defined(_WIN32_WCE) && !defined( OS_PLATFORM_MOTCE )
|
175
|
-
HRESULT hr = S_OK;
|
176
|
-
HRESULT co_init_result = CoInitializeEx(NULL, 0); //COINIT_APARTMENTTHREADED
|
177
|
-
if ( (co_init_result == S_OK) || (co_init_result == S_FALSE) )
|
178
|
-
{
|
179
|
-
IInkOverlay* pInkOverlay = 0;
|
180
|
-
hr = ::CoCreateInstance(CLSID_InkOverlay,
|
181
|
-
NULL,
|
182
|
-
CLSCTX_INPROC_SERVER,
|
183
|
-
IID_IInkOverlay,
|
184
|
-
(void **)&pInkOverlay);
|
185
|
-
if (pInkOverlay != NULL)
|
186
|
-
{
|
187
|
-
m_pInkImpl = pInkOverlay;
|
188
|
-
|
189
|
-
CComPtr<IInkDrawingAttributes> spIInkDrawAttrs = NULL;
|
190
|
-
hr = pInkOverlay->get_DefaultDrawingAttributes(&spIInkDrawAttrs);
|
191
|
-
if (SUCCEEDED(hr))
|
192
|
-
{
|
193
|
-
spIInkDrawAttrs->put_Color(getParams().getPenColor());
|
194
|
-
//HIMETRIC = (PIXEL * 2540) / 96
|
195
|
-
spIInkDrawAttrs->put_Width( ((float)getParams().getPenWidth()*2540)/96 );
|
196
|
-
|
197
|
-
// Set the new drawing attributes
|
198
|
-
pInkOverlay->putref_DefaultDrawingAttributes(spIInkDrawAttrs);
|
199
|
-
}
|
200
|
-
|
201
|
-
// Attach the inkoverlay object to the window and enable it to start collecting ink
|
202
|
-
pInkOverlay->put_hWnd((long)m_hWnd);
|
203
|
-
hr = pInkOverlay->put_Enabled(VARIANT_TRUE);
|
204
|
-
}
|
205
|
-
else {
|
206
|
-
RAWLOG_ERROR("ERROR: Can not get Ink Overlay in Signature Capture !");
|
207
|
-
}
|
208
|
-
}
|
209
|
-
else {
|
210
|
-
RAWLOG_ERROR("ERROR: Can not Signature CoInitialize !");
|
211
|
-
}
|
212
|
-
#endif //!APP_BUILD_CAPABILITY_WEBKIT_BROWSER
|
213
|
-
|
214
147
|
return FALSE;
|
215
148
|
}
|
216
149
|
|
@@ -220,88 +153,194 @@ LRESULT CRhoSignatureWindow::OnClearCommand(WORD /*wNotifyCode*/, WORD wID, HWND
|
|
220
153
|
return FALSE;
|
221
154
|
}
|
222
155
|
|
223
|
-
|
156
|
+
void CRhoSignatureWindow::addNewPoint(int x, int y, bool bNewLine)
|
224
157
|
{
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
158
|
+
m_vecPoints.addElement( CSigPoint( x, y, bNewLine ) );
|
159
|
+
}
|
160
|
+
|
161
|
+
void CRhoSignatureWindow::sendVectors()
|
162
|
+
{
|
163
|
+
if ( !m_bDoVectors )
|
164
|
+
return;
|
165
|
+
#if 0
|
166
|
+
TCHAR szTarget[MAXURL + 1];
|
167
|
+
LPTSTR pIndex;
|
168
|
+
int iTotalLen,iStrLen,iErr = 1;
|
169
|
+
CSignature *pObj = (CSignature *)lParam;
|
170
|
+
P_COORDXY pPoint = pObj->m_pCurrentVector;
|
171
|
+
|
172
|
+
while(pPoint) // we need at least 2 points for a line
|
173
|
+
{
|
174
|
+
wcscpy(szTarget,L"new Array(");
|
175
|
+
iTotalLen = 10;
|
176
|
+
pIndex = szTarget + 10;
|
177
|
+
//set our pointer past 'new Array('
|
178
|
+
while(pPoint && iTotalLen < ((MAXLEN_VECTORARR / 2) - 13))
|
179
|
+
{
|
180
|
+
if(pPoint->bNewLine){
|
181
|
+
wcscpy(pIndex,L"0xFFFF,0xFFFF,");
|
182
|
+
iTotalLen += 14;
|
183
|
+
pIndex += 14;
|
184
|
+
|
185
|
+
}
|
186
|
+
|
187
|
+
iStrLen = wsprintf(pIndex,L"0x%X,0x%X,",pPoint->XPos,pPoint->YPos);
|
188
|
+
iTotalLen += iStrLen;
|
189
|
+
pIndex += iStrLen;
|
190
|
+
|
191
|
+
pPoint = pPoint->pPoint;
|
192
|
+
|
193
|
+
}
|
194
|
+
|
195
|
+
|
196
|
+
if(pPoint){ // if we haven't finished outputting this batch of points
|
197
|
+
--pIndex; //get rid of the last seperator
|
198
|
+
*pIndex = L')'; //add the bracket
|
199
|
+
pIndex++;
|
200
|
+
*pIndex = NULL; //finally NULL terminate
|
201
|
+
|
202
|
+
}
|
203
|
+
else{
|
204
|
+
*pIndex = NULL; //we have reached the end of a batch send
|
205
|
+
wcscat(szTarget,L"0xFFFF,0xFFFF)");//add the last point indicator
|
206
|
+
}
|
207
|
+
|
208
|
+
//navigate
|
209
|
+
if(pObj && pObj->m_hParent && *pObj->m_tcVectorNavigateURI != NULL)
|
210
|
+
{
|
211
|
+
//RHO
|
212
|
+
//TODO: SendPBNavigate
|
213
|
+
//pObj->m_pModule->SendPBNavigate(tcVectorEventNames, pObj->m_iInstanceID, pObj->m_tcVectorNavigateURI, szTarget, NULL);
|
214
|
+
//RHO
|
215
|
+
iErr = 0;
|
216
|
+
}
|
217
|
+
}
|
229
218
|
#endif
|
219
|
+
}
|
220
|
+
|
221
|
+
LRESULT CRhoSignatureWindow::OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
222
|
+
{
|
223
|
+
//LOG(INFO) + "DOWN: " + (int)LOWORD(lParam) + "," + (int)HIWORD(lParam);
|
224
|
+
|
225
|
+
addNewPoint( LOWORD(lParam), HIWORD(lParam), true );
|
226
|
+
|
227
|
+
SetCapture();
|
228
|
+
m_bCapture = true;
|
229
|
+
m_bOutOfSignature = false;
|
230
|
+
m_ptLast = CPoint(LOWORD(lParam), HIWORD(lParam));
|
231
|
+
|
230
232
|
return TRUE;
|
231
233
|
}
|
232
234
|
|
233
235
|
LRESULT CRhoSignatureWindow::OnLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
234
236
|
{
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
237
|
+
//LOG(INFO) + "UP: " + (int)LOWORD(lParam) + "," + (int)HIWORD(lParam);
|
238
|
+
ReleaseCapture();
|
239
|
+
m_bCapture = false;
|
240
|
+
m_ptLast = CPoint(-1, -1);
|
241
|
+
//sendVectors();
|
242
|
+
|
240
243
|
return TRUE;
|
241
244
|
}
|
242
245
|
|
243
246
|
LRESULT CRhoSignatureWindow::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
244
247
|
{
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
248
|
+
//LOG(INFO) + "MouseMove: " + (int)LOWORD(lParam) + "," + (int)HIWORD(lParam);
|
249
|
+
|
250
|
+
if (!m_bCapture)
|
251
|
+
return TRUE;
|
252
|
+
|
253
|
+
if ( !m_bOutOfSignature && m_ptLast.x >= 0 )
|
254
|
+
{
|
255
|
+
int xDelta = abs(LOWORD(lParam)-m_ptLast.x);
|
256
|
+
int yDelta = abs(HIWORD(lParam)-m_ptLast.y);
|
257
|
+
|
258
|
+
if ( xDelta > 30 || yDelta >30 )
|
259
|
+
{
|
260
|
+
LOG(ERROR) + "Sporadic stroke!";
|
261
|
+
return TRUE;
|
262
|
+
}
|
263
|
+
}
|
264
|
+
|
265
|
+
m_ptLast = CPoint(LOWORD(lParam), HIWORD(lParam));
|
266
|
+
CRect rcClient;
|
267
|
+
GetClientRect(rcClient);
|
268
|
+
if ( !rcClient.PtInRect( CPoint( LOWORD(lParam), HIWORD(lParam) ) ) )
|
269
|
+
{
|
270
|
+
m_bOutOfSignature = true;
|
271
|
+
return TRUE;
|
272
|
+
}
|
273
|
+
|
274
|
+
if ( m_bOutOfSignature )
|
275
|
+
{
|
276
|
+
addNewPoint( LOWORD(lParam), HIWORD(lParam), true );
|
277
|
+
m_bOutOfSignature = false;
|
278
|
+
}else
|
279
|
+
{
|
280
|
+
|
281
|
+
addNewPoint( LOWORD(lParam), HIWORD(lParam), false );
|
282
|
+
}
|
283
|
+
|
284
|
+
drawLastStroke();
|
285
|
+
|
250
286
|
return TRUE;
|
251
287
|
}
|
252
288
|
|
289
|
+
void CRhoSignatureWindow::drawLastStroke()
|
290
|
+
{
|
291
|
+
CDC oDC(GetDC());
|
292
|
+
|
293
|
+
CPen oPen;
|
294
|
+
oPen.CreatePen( PS_SOLID, getParams().getPenWidth(), getParams().getPenColor() );
|
295
|
+
HPEN hOldPen = oDC.SelectPen( oPen );
|
296
|
+
|
297
|
+
int nLastPos = m_vecPoints.size()-1;
|
298
|
+
if ( nLastPos > 0 && !m_vecPoints[nLastPos].m_bNewLine )
|
299
|
+
{
|
300
|
+
oDC.MoveTo( m_vecPoints[nLastPos-1].m_xPos, m_vecPoints[nLastPos-1].m_yPos );
|
301
|
+
oDC.LineTo( m_vecPoints[nLastPos].m_xPos, m_vecPoints[nLastPos].m_yPos );
|
302
|
+
}
|
303
|
+
|
304
|
+
oDC.SelectPen( hOldPen );
|
305
|
+
}
|
306
|
+
|
253
307
|
LRESULT CRhoSignatureWindow::OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
254
308
|
{
|
255
|
-
#ifdef APP_BUILD_CAPABILITY_WEBKIT_BROWSER
|
256
|
-
return rho_wmimpl_signatureSigProcCall(m_pInkImpl, m_hWnd, uMsg, wParam, lParam);
|
257
|
-
#else
|
258
309
|
CPaintDC oPaintDC(m_hWnd);
|
310
|
+
|
259
311
|
CRect rcClient;
|
260
312
|
GetClientRect(rcClient);
|
261
|
-
|
262
|
-
|
263
|
-
|
313
|
+
|
314
|
+
drawSignature( oPaintDC, rcClient );
|
315
|
+
|
264
316
|
return TRUE;
|
265
317
|
}
|
266
318
|
|
267
|
-
void CRhoSignatureWindow::
|
319
|
+
void CRhoSignatureWindow::drawSignature( CDC& oDC, CRect& rcDraw )
|
268
320
|
{
|
269
|
-
|
321
|
+
oDC.FillSolidRect(rcDraw, getParams().getBgColor() );
|
270
322
|
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
#else
|
275
|
-
HBITMAP hBitmap = getScreenBitmap();
|
276
|
-
m_hResult = saveBitmapToFile( hBitmap, strFilePathW.c_str(), convertToStringW(getParams().getFileFormat()).c_str() );
|
277
|
-
DeleteObject(hBitmap);
|
278
|
-
#endif
|
279
|
-
}
|
323
|
+
CPen oPen;
|
324
|
+
oPen.CreatePen( PS_SOLID, getParams().getPenWidth(), getParams().getPenColor() );
|
325
|
+
HPEN hOldPen = oDC.SelectPen( oPen );
|
280
326
|
|
281
|
-
|
282
|
-
{
|
283
|
-
#ifdef APP_BUILD_CAPABILITY_WEBKIT_BROWSER
|
284
|
-
if (m_pInkImpl != NULL)
|
327
|
+
for( int i = 0; i < (int)m_vecPoints.size()-1; i++ )
|
285
328
|
{
|
286
|
-
|
329
|
+
if ( m_vecPoints[i+1].m_bNewLine )
|
330
|
+
continue;
|
331
|
+
|
332
|
+
oDC.MoveTo( m_vecPoints[i].m_xPos, m_vecPoints[i].m_yPos );
|
333
|
+
oDC.LineTo( m_vecPoints[i+1].m_xPos, m_vecPoints[i+1].m_yPos );
|
287
334
|
}
|
288
|
-
#else
|
289
335
|
|
290
|
-
|
291
|
-
if (m_pInkImpl != NULL)
|
292
|
-
{
|
293
|
-
CComPtr<IInkDisp> pDisp;
|
294
|
-
HRESULT hRes = ((IInkOverlay*)m_pInkImpl)->get_Ink(&pDisp);
|
295
|
-
if ( SUCCEEDED(hRes) && pDisp )
|
296
|
-
{
|
297
|
-
pDisp->DeleteStrokes();
|
336
|
+
oDC.SelectPen( hOldPen );
|
298
337
|
|
299
|
-
|
300
|
-
}
|
301
|
-
}
|
302
|
-
#endif
|
338
|
+
}
|
303
339
|
|
304
|
-
|
340
|
+
void CRhoSignatureWindow::clearImage()
|
341
|
+
{
|
342
|
+
m_vecPoints.removeAllElements();
|
343
|
+
InvalidateRect(NULL,TRUE);
|
305
344
|
}
|
306
345
|
|
307
346
|
LRESULT CRhoSignatureWindow::OnOK(WORD /*wNotifyCode*/, WORD wID, HWND hwnd, BOOL& /*bHandled*/)
|
@@ -322,8 +361,18 @@ LRESULT CRhoSignatureWindow::OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWn
|
|
322
361
|
return 0;
|
323
362
|
}
|
324
363
|
|
325
|
-
|
364
|
+
void RGBFromColour (RGBQUAD *prgb, COLORREF colour)
|
365
|
+
{
|
366
|
+
prgb->rgbBlue = (BYTE) ((colour & 0x00FF0000) >> 16);
|
367
|
+
prgb->rgbGreen = (BYTE) ((colour & 0x0000FF00) >> 8);
|
368
|
+
prgb->rgbRed = (BYTE) (colour & 0x000000FF);
|
369
|
+
prgb->rgbReserved = 0;
|
370
|
+
}
|
371
|
+
|
372
|
+
void CRhoSignatureWindow::saveImage()
|
326
373
|
{
|
374
|
+
StringW strFilePathW = convertToStringW( getParams().getFilePath() );
|
375
|
+
|
327
376
|
// get screen rectangle
|
328
377
|
CRect windowRect;
|
329
378
|
GetWindowRect(&windowRect);
|
@@ -352,35 +401,76 @@ HBITMAP CRhoSignatureWindow::getScreenBitmap()
|
|
352
401
|
infoHeader.biWidth = bitmap_dx;
|
353
402
|
infoHeader.biHeight = bitmap_dy;
|
354
403
|
infoHeader.biPlanes = 1;
|
355
|
-
infoHeader.biBitCount =
|
404
|
+
infoHeader.biBitCount = 1;
|
356
405
|
infoHeader.biCompression = BI_RGB;
|
357
406
|
|
358
407
|
// dibsection information
|
359
|
-
BITMAPINFO
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
BYTE* memory = 0;
|
364
|
-
HBITMAP bitmap = CreateDIBSection(winDC, &info, DIB_RGB_COLORS, (void**)&memory, 0, 0);
|
365
|
-
HBITMAP old_selected = (HBITMAP)SelectObject(memDC, bitmap);
|
366
|
-
// Copies screen upside down (as it is already upside down) - if need normal layout, change to BitBlt function call
|
367
|
-
StretchBlt(memDC, 0, 0, bitmap_dx, bitmap_dy, winDC, hasBorder ? 1 : 0, bitmap_dy+(hasBorder ? 1 : 0)+nTopHeader, bitmap_dx, bitmap_dy * -1, SRCCOPY);
|
368
|
-
SelectObject(memDC, old_selected);
|
369
|
-
DeleteDC(memDC);
|
370
|
-
ReleaseDC(winDC);
|
408
|
+
BITMAPINFO* pInfo = (BITMAPINFO*)(new BYTE [sizeof (BITMAPINFOHEADER) + 2 * sizeof (RGBQUAD)]);
|
409
|
+
pInfo->bmiHeader = infoHeader;
|
410
|
+
RGBFromColour( &(pInfo->bmiColors[0]), getParams().getPenColor() );
|
411
|
+
RGBFromColour( &(pInfo->bmiColors[1]), getParams().getBgColor() );
|
371
412
|
|
372
|
-
|
373
|
-
|
413
|
+
BYTE* memory = 0;
|
414
|
+
HBITMAP hBitmap = 0;
|
415
|
+
{
|
416
|
+
CDC memDC = CreateCompatibleDC(NULL);
|
417
|
+
hBitmap = CreateDIBSection( NULL, pInfo, DIB_RGB_COLORS, (void**)&memory, 0, 0 );
|
418
|
+
HBITMAP hBmpOld = (HBITMAP)SelectObject( memDC, hBitmap );
|
419
|
+
// Copies screen upside down (as it is already upside down) - if need normal layout, change to BitBlt function call
|
420
|
+
//StretchBlt(memDC, 0, 0, bitmap_dx, bitmap_dy, winDC, hasBorder ? 1 : 0, bitmap_dy+(hasBorder ? 1 : 0)+nTopHeader, bitmap_dx, bitmap_dy /* * -1 */, SRCCOPY);
|
421
|
+
drawSignature( memDC, CRect(0,0, bitmap_dx, bitmap_dy ) );
|
422
|
+
SelectObject( memDC, hBmpOld );
|
423
|
+
}
|
424
|
+
|
425
|
+
//#if defined(_WIN32_WCE) && !defined( OS_PLATFORM_MOTCE )
|
426
|
+
// m_hResult = saveBitmapToFileByImageFactory( hBitmap, strFilePathW.c_str(), convertToStringW(getParams().getFileFormat()).c_str() );
|
427
|
+
//#else
|
428
|
+
if ( getParams().getFileFormat().compare("bmp") != 0 )
|
429
|
+
{
|
430
|
+
LOG(ERROR) + "Windows support only bmp image format.";
|
431
|
+
m_hResult = E_FAIL;
|
432
|
+
}else
|
433
|
+
{
|
434
|
+
int bytes_per_line = ((bitmap_dx + 31) & (~31)) / 8;
|
435
|
+
BITMAPFILEHEADER bfh = {0};
|
436
|
+
bfh.bfType = 0x4D42;
|
437
|
+
bfh.bfOffBits = sizeof( bfh ) + sizeof (BITMAPINFOHEADER) + 2 * sizeof (RGBQUAD);
|
438
|
+
bfh.bfSize = bfh.bfOffBits + (bytes_per_line * bitmap_dy);
|
439
|
+
|
440
|
+
//RGBFromColour( &(pInfo->bmiColors[0]), getParams().getPenColor() );
|
441
|
+
//RGBFromColour( &(pInfo->bmiColors[1]), getParams().getBgColor() );
|
442
|
+
|
443
|
+
// Write file
|
444
|
+
FILE *pfile = _wfopen( strFilePathW.c_str(), L"wb" );
|
445
|
+
if (pfile)
|
446
|
+
{
|
447
|
+
fwrite( &bfh, sizeof (BITMAPFILEHEADER), 1, pfile );
|
448
|
+
fwrite( &(pInfo->bmiHeader), sizeof (BITMAPINFOHEADER), 1, pfile );
|
449
|
+
fwrite( pInfo->bmiColors, sizeof (RGBQUAD), 2, pfile );
|
450
|
+
fwrite( memory, 1, bytes_per_line * bitmap_dy, pfile );
|
451
|
+
fclose( pfile );
|
452
|
+
}
|
453
|
+
|
454
|
+
m_hResult = S_OK;
|
455
|
+
}
|
456
|
+
|
457
|
+
//#endif
|
374
458
|
|
375
|
-
|
459
|
+
delete pInfo;
|
460
|
+
DeleteObject(hBitmap);
|
461
|
+
}
|
462
|
+
/*
|
463
|
+
HRESULT CRhoSignatureWindow::saveBitmapToFileByImageFactory( HBITMAP hBitmap, LPCTSTR filename, LPCTSTR format)
|
376
464
|
{
|
377
465
|
HRESULT res = S_OK;
|
378
|
-
|
466
|
+
|
467
|
+
#if defined(_WIN32_WCE) && !defined( OS_PLATFORM_MOTCE )
|
379
468
|
IImagingFactory* factory=NULL;
|
380
469
|
if (CoCreateInstance(CLSID_ImagingFactory, NULL, CLSCTX_INPROC_SERVER, IID_IImagingFactory, (void**)&factory) == S_OK) {
|
381
470
|
UINT count;
|
382
471
|
ImageCodecInfo* imageCodecInfo=NULL;
|
383
|
-
if (factory->GetInstalledEncoders(&count, &imageCodecInfo) == S_OK)
|
472
|
+
if (factory->GetInstalledEncoders(&count, &imageCodecInfo) == S_OK)
|
473
|
+
{
|
384
474
|
// Get the particular encoder to use
|
385
475
|
LPTSTR formatString;
|
386
476
|
if (wcscmp(format, L"png") == 0) {
|
@@ -391,7 +481,10 @@ HRESULT CRhoSignatureWindow::saveBitmapToFile( HBITMAP hBitmap, LPCTSTR filename
|
|
391
481
|
formatString = _T("image/gif");
|
392
482
|
} else if (wcscmp(format, L"bmp") == 0) {
|
393
483
|
formatString = _T("image/bmp");
|
394
|
-
} else
|
484
|
+
} else
|
485
|
+
{
|
486
|
+
LOG(ERROR) + "Unsupported image format:" + format;
|
487
|
+
|
395
488
|
factory->Release();
|
396
489
|
CoUninitialize();
|
397
490
|
return S_FALSE;
|
@@ -461,6 +554,7 @@ HRESULT CRhoSignatureWindow::saveBitmapToFile( HBITMAP hBitmap, LPCTSTR filename
|
|
461
554
|
UINT bitStride = bitAlignment * (bitsPerLine / bitAlignment); // The image buffer is always padded to LONG boundaries
|
462
555
|
if ((bitsPerLine % bitAlignment) != 0) bitStride += bitAlignment; // Add a bit more for the leftover values
|
463
556
|
bmData->Stride = (bitStride / 8);
|
557
|
+
bmData->Stride *= -1;
|
464
558
|
|
465
559
|
IBitmapImage* pBitmap;
|
466
560
|
factory->CreateBitmapFromBuffer(bmData, &pBitmap);
|
@@ -497,6 +591,7 @@ HRESULT CRhoSignatureWindow::saveBitmapToFile( HBITMAP hBitmap, LPCTSTR filename
|
|
497
591
|
|
498
592
|
return res;
|
499
593
|
}
|
594
|
+
*/
|
500
595
|
|
501
596
|
static void readIntFromParam(rho_param* params, const char* szName, long& res)
|
502
597
|
{
|
@@ -523,7 +618,7 @@ CRect CRhoSignature::CParams::getWndRect()
|
|
523
618
|
::GetWindowRect(getMainWnd(), rcDefault);
|
524
619
|
}else
|
525
620
|
{
|
526
|
-
rcDefault = CRect(
|
621
|
+
rcDefault = CRect(30, 100, 30 + 200, 100 + 150);
|
527
622
|
}
|
528
623
|
|
529
624
|
if (rcWnd.left == -1)
|
@@ -573,7 +668,7 @@ const String& CRhoSignature::CParams::getFileFormat()
|
|
573
668
|
if ( m_strFileFormat.length() > 0 )
|
574
669
|
return m_strFileFormat;
|
575
670
|
|
576
|
-
m_strFileFormat = "
|
671
|
+
m_strFileFormat = "bmp";
|
577
672
|
|
578
673
|
return m_strFileFormat;
|
579
674
|
}
|