rhodes 3.3.2 → 3.3.3.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/CHANGELOG +3 -0
  2. data/Manifest.txt +4 -0
  3. data/Rakefile +2 -2
  4. data/doc/device-caps.txt +2 -2
  5. data/doc/rhodes-api.txt +0 -3
  6. data/installer/rhostudio-moto.nsi +14 -48
  7. data/installer/rhostudio.nsi +12 -12
  8. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +167 -46
  9. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +1 -1
  10. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SplashScreen.java +15 -15
  11. data/platform/android/build/android.rake +36 -24
  12. data/platform/iphone/Classes/MapView/GoogleGeocoder.h +2 -1
  13. data/platform/iphone/Classes/MapView/GoogleGeocoder.m +44 -6
  14. data/platform/iphone/Classes/MapView/MapViewController.m +10 -1
  15. data/platform/shared/common/ExtManager.cpp +103 -0
  16. data/platform/shared/common/ExtManager.h +101 -0
  17. data/platform/shared/common/RhodesApp.cpp +3 -2
  18. data/platform/shared/common/RhodesApp.h +3 -0
  19. data/platform/shared/common/map/GeocodingMapEngine.cpp +24 -1
  20. data/platform/shared/common/map/GeocodingMapEngine.h +3 -0
  21. data/platform/shared/logging/RhoLogConf.cpp +2 -1
  22. data/platform/shared/net/HttpServer.cpp +1 -1
  23. data/platform/shared/ruby/ext/rho/rhoruby.c +6 -0
  24. data/platform/wm/RhoLib/RhoLib.vcproj +8 -0
  25. data/platform/wm/rhodes/DateTimePicker.cpp +38 -8
  26. data/platform/wm/rhodes/DateTimePicker.h +4 -0
  27. data/platform/wm/rhodes/LogOptionsDlg.cpp +16 -0
  28. data/platform/wm/rhodes/LogOptionsDlg.h +3 -2
  29. data/platform/wm/rhodes/LogView.cpp +21 -1
  30. data/platform/wm/rhodes/LogView.h +3 -1
  31. data/platform/wm/rhodes/MainWindow.cpp +1 -2
  32. data/platform/wm/rhodes/MapView/MapViewManager.cpp +16 -2
  33. data/platform/wm/rhodes/MapView/MapViewManager.h +2 -0
  34. data/platform/wm/rhodes/Rhodes.cpp +2 -1
  35. data/platform/wm/rhodes/Rhodes.rc +7 -6
  36. data/platform/wm/rhodes/rho/rubyext/RhoSignature.cpp +303 -147
  37. data/platform/wm/rhodes/rho/rubyext/RhoSignature.h +22 -16
  38. data/platform/wm/rhoelements.sln +3 -3
  39. data/platform/wp7/RhoRubyLib/common/RhoFile.cs +16 -0
  40. data/platform/wp7/RhoRubyLib/net/HttpServer.cs +5 -5
  41. data/platform/wp7/RhoRubyLib/views/RhoView.xaml +1 -1
  42. data/platform/wp7/RhoRubyLib/views/RhoView.xaml.cs +36 -3
  43. data/rakefile.rb +2 -2
  44. data/res/generators/rhogen.rb +5 -0
  45. data/res/generators/templates/application/app/layout.erb +6 -2
  46. data/res/generators/templates/application/public/js/jquery-wp7-patch.js +149 -0
  47. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/Montana.sln +29 -7
  48. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/Montana.vcproj +316 -0
  49. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/montana.vsprops +15 -0
  50. data/version +1 -1
  51. metadata +11 -5
@@ -90,6 +90,7 @@ struct CBarcodeInit
90
90
  CBarcodeInit()
91
91
  {
92
92
  m_bMC4900 = false;
93
+ /*
93
94
  OSVERSIONINFO osv = {0};
94
95
  osv.dwOSVersionInfoSize = sizeof(osv);
95
96
  if (GetVersionEx(&osv))
@@ -98,7 +99,7 @@ struct CBarcodeInit
98
99
  RAWLOG_INFO1("CBarcodeInit : OS version : %d", osv.dwMajorVersion);
99
100
 
100
101
  if ( m_bMC4900 )
101
- rho_scanner_before_webkit();
102
+ rho_scanner_before_webkit();*/
102
103
  }
103
104
 
104
105
  static DWORD afterWebkit(LPVOID ){ rho_scanner_after_webkit(); return 0; }
@@ -124,12 +124,12 @@ BEGIN
124
124
  MENUITEM "Close", IDOK
125
125
  END
126
126
 
127
-
128
127
  IDR_SIGNATURE_MENU MENU
129
128
  BEGIN
130
129
  MENUITEM "Clear", IDM_CLEAR
131
130
  END
132
131
 
132
+
133
133
  /////////////////////////////////////////////////////////////////////////////
134
134
  //
135
135
  // Dialog
@@ -198,7 +198,7 @@ BEGIN
198
198
  PUSHBUTTON "Cancel",IDCANCEL,97,87,50,14
199
199
  END
200
200
 
201
- IDD_DATETIME_PICKER DIALOGEX 0, 0, 172, 186
201
+ IDD_DATETIME_PICKER DIALOG 0, 0, 172, 186
202
202
  STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
203
203
  CAPTION "DateTime Picker"
204
204
  FONT 8, "Microsoft Sans Serif"
@@ -207,16 +207,16 @@ BEGIN
207
207
  CONTROL "",IDC_DATE_CTRL,"SysDateTimePick32",DTS_RIGHTALIGN | WS_TABSTOP,7,29,143,15
208
208
  LTEXT "Time:",IDC_TIME_STATIC,7,44,25,10
209
209
  LTEXT "Date:",IDC_DATE_STATIC,7,21,27,8
210
- LTEXT "DateTime Picker",ID_DATETIME_CAPTION,9,6,141,8
210
+ LTEXT "DateTime Picker",ID_DATETIME_CAPTION,9,6,107,8
211
211
  END
212
212
 
213
- IDD_TIME_PICKER DIALOGEX 0, 0, 172, 186
213
+ IDD_TIME_PICKER DIALOG 0, 0, 172, 186
214
214
  STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_SYSMENU
215
215
  FONT 8, "MS Shell Dlg"
216
216
  BEGIN
217
217
  CONTROL "",IDC_TIME_CTRL,"SysDateTimePick32",DTS_RIGHTALIGN | DTS_UPDOWN | WS_TABSTOP | 0x8,7,29,143,15
218
218
  LTEXT "Time:",IDC_TIME_STATIC,7,21,27,8
219
- LTEXT "Time Picker",ID_TIME_CAPTION,9,6,142,8
219
+ LTEXT "Time Picker",ID_TIME_CAPTION,9,6,110,8
220
220
  END
221
221
 
222
222
  IDD_BLUETOOTH_DISCOVER DIALOG 0, 0, 172, 186
@@ -251,11 +251,12 @@ BEGIN
251
251
  END
252
252
 
253
253
  IDD_TAKE_SIGNATURE DIALOG 0, 0, 135, 105
254
- STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_SYSMENU// | WS_CAPTION
254
+ STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_SYSMENU
255
255
  FONT 8, "MS Shell Dlg"
256
256
  BEGIN
257
257
  END
258
258
 
259
+
259
260
  /////////////////////////////////////////////////////////////////////////////
260
261
  //
261
262
  // DESIGNINFO
@@ -20,6 +20,7 @@ extern BOOL rho_wmimpl_saveSignature(void *inkImpl, LPCTSTR szFilePathName);
20
20
 
21
21
  extern "C" HWND getMainWnd();
22
22
  extern "C" HWND getWebViewWnd(int index);
23
+ extern "C" void rho_webview_navigate(const char* url, int index);
23
24
 
24
25
  namespace rho
25
26
  {
@@ -34,6 +35,14 @@ CRhoSignature::~CRhoSignature(void)
34
35
  {
35
36
  }
36
37
 
38
+ static bool namecmp(const wchar_t* tc1, LPCTSTR tc2)
39
+ {
40
+ if (!tc1 || !tc2)
41
+ return false;
42
+
43
+ return !_wcsicmp( (LPCTSTR)tc1, tc2);
44
+ }
45
+
37
46
  /*static*/ void CRhoSignature::takeSignature(CParams* params)
38
47
  {
39
48
  CModalParams& oSigParams = *((CModalParams*)params);
@@ -160,62 +169,31 @@ void CRhoSignatureWindow::addNewPoint(int x, int y, bool bNewLine)
160
169
 
161
170
  void CRhoSignatureWindow::sendVectors()
162
171
  {
163
- if ( !m_bDoVectors )
172
+ if ( !getParams().m_bSendVectors )
164
173
  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
174
 
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
- }
218
- #endif
175
+ if ( getParams().m_strSendVectorJS.length() == 0 )
176
+ return;
177
+
178
+ String strTarget = m_vecPoints.size() > 1 ? "new Array(" : "" ;
179
+ char szPtBuf[100];
180
+ for( int i = 0; i < (int)m_vecPoints.size()-1; i++ )
181
+ {
182
+ if ( m_vecPoints[i+1].m_bNewLine )
183
+ strTarget += "0xFFFF,0xFFFF,";
184
+
185
+ sprintf( szPtBuf, "0x%X,0x%X,", m_vecPoints[i].m_xPos, m_vecPoints[i].m_yPos );
186
+
187
+ strTarget += szPtBuf;
188
+ }
189
+
190
+ strTarget += "0xFFFF,0xFFFF)";
191
+
192
+ //TODO: send vector
193
+ //m_strSendVectorJS + "(" + strTarget + ")"
194
+ //BUT : "VectorEvent:url('Javascript:onVectors(%s);')"
195
+ //rho_webview_navigate( );
196
+
219
197
  }
220
198
 
221
199
  LRESULT CRhoSignatureWindow::OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
@@ -238,7 +216,7 @@ LRESULT CRhoSignatureWindow::OnLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam
238
216
  ReleaseCapture();
239
217
  m_bCapture = false;
240
218
  m_ptLast = CPoint(-1, -1);
241
- //sendVectors();
219
+ sendVectors();
242
220
 
243
221
  return TRUE;
244
222
  }
@@ -600,144 +578,313 @@ static void readIntFromParam(rho_param* params, const char* szName, long& res)
600
578
  convertFromStringA( p->v.string, res );
601
579
  }
602
580
 
603
- CRect CRhoSignature::CParams::getWndRect()
581
+ static int getColorFromString(const char* szColor)
604
582
  {
605
- CRect rcDefault, rcWnd(-1,-1,-1,-1);
606
- if (m_params)
607
- {
608
- readIntFromParam(m_params, "left", rcWnd.left);
609
- readIntFromParam(m_params, "top", rcWnd.top);
610
- readIntFromParam(m_params, "width", rcWnd.right);
611
- rcWnd.right += rcWnd.left > 0 ? rcWnd.left : 0;
612
- readIntFromParam(m_params, "height", rcWnd.bottom);
613
- rcWnd.bottom += rcWnd.top > 0 ? rcWnd.top : 0;
614
- }
583
+ if ( !szColor || !*szColor )
584
+ return RGB(0, 0, 0);
615
585
 
616
- if ( m_eType == esModal )
617
- {
618
- ::GetWindowRect(getMainWnd(), rcDefault);
619
- }else
620
- {
621
- rcDefault = CRect(30, 100, 30 + 200, 100 + 150);
622
- }
586
+ int c = atoi(szColor);
623
587
 
624
- if (rcWnd.left == -1)
625
- rcWnd.left = rcDefault.left;
626
- if (rcWnd.top == -1)
627
- rcWnd.top = rcDefault.top;
628
- if (rcWnd.right == -1)
629
- rcWnd.right = rcDefault.right;
630
- if (rcWnd.bottom == -1)
631
- rcWnd.bottom = rcDefault.bottom;
588
+ int cR = (c & 0xFF0000) >> 16;
589
+ int cG = (c & 0xFF00) >> 8;
590
+ int cB = (c & 0xFF);
632
591
 
633
- return rcWnd;
592
+ return RGB(cR, cG, cB);
634
593
  }
635
594
 
636
- const String& CRhoSignature::CParams::getFilePath()
595
+ static BYTE CharHexToByte(TCHAR chHex)
637
596
  {
638
- if ( m_strFilePath.length() > 0 )
639
- return m_strFilePath;
640
-
641
- if (m_params)
642
- {
643
- rho_param* pFP = rho_param_hash_get(m_params, "filePath");
644
- if ( pFP )
645
- m_strFilePath = pFP->v.string;
646
- }
597
+ TCHAR ch = chHex;
598
+ ch = towupper(chHex);
599
+ TCHAR conv[] = {L"0123456789ABCDEF"};
600
+ int byIndex;
601
+ for(byIndex = 0;ch != conv[byIndex];byIndex++);
602
+ return byIndex;
603
+
604
+ }
647
605
 
648
- if ( m_strFilePath.length() > 0 )
649
- return m_strFilePath;
606
+ static COLORREF getColorFromMetaString(LPCTSTR lpSzColor)
607
+ {
608
+ TCHAR pStr[7];
609
+ int iVal;
610
+ BYTE byCol[3];
611
+
612
+ if(wcslen(lpSzColor)!= 7)
613
+ return FALSE;
650
614
 
651
- m_strFilePath = RHODESAPPBASE().getBlobsDirPath() + "/Image_" + CLocalTime().toString(true,true) + "." + getFileFormat();
615
+ for(int loop = 0;loop < 3;loop++)
616
+ {
617
+ _tcscpy(pStr,lpSzColor +(loop * 2)+ 1);
618
+ pStr[2] = '\0';
619
+
620
+ iVal = CharHexToByte(*pStr);
621
+ byCol[loop] = (iVal * 16) + CharHexToByte(*(pStr+1));
652
622
 
653
- return m_strFilePath;
623
+ }
624
+ COLORREF nCrColor = 0; //set the COLORREF to 0
625
+ nCrColor = (byCol[0] << 16)|(byCol[1] << 8)|(byCol[2]);
626
+
627
+ return nCrColor;
654
628
  }
655
629
 
656
- const String& CRhoSignature::CParams::getFileFormat()
630
+ void CRhoSignature::CParams::readParams(rho_param* params)
657
631
  {
658
- if ( m_strFileFormat.length() > 0 )
659
- return m_strFileFormat;
632
+ m_nLeft = m_nTop = m_nWidth = m_nHeight = -1;
633
+ if ( params )
634
+ {
635
+ readIntFromParam(params, "left", m_nLeft);
636
+ readIntFromParam(params, "top", m_nTop);
637
+ readIntFromParam(params, "width", m_nWidth);
638
+ readIntFromParam(params, "height", m_nHeight);
639
+ }
640
+
641
+ if (params)
642
+ {
643
+ rho_param* pFP = rho_param_hash_get(params, "filePath");
644
+ if ( pFP )
645
+ m_strFilePath = pFP->v.string;
646
+ }
647
+
648
+ if ( m_strFilePath.length() == 0 )
649
+ m_strFilePath = RHODESAPPBASE().getBlobsDirPath() + "/Image_" + CLocalTime().toString(true,true) + "." + getFileFormat();
660
650
 
661
- if (m_params)
651
+ if (params)
662
652
  {
663
- rho_param* pFF = rho_param_hash_get(m_params, "imageFormat");
653
+ rho_param* pFF = rho_param_hash_get(params, "imageFormat");
664
654
  if ( pFF )
665
655
  m_strFileFormat = pFF->v.string;
666
656
  }
667
657
 
668
- if ( m_strFileFormat.length() > 0 )
669
- return m_strFileFormat;
658
+ if ( m_strFileFormat.length() == 0 )
659
+ m_strFileFormat = "bmp";
670
660
 
671
- m_strFileFormat = "bmp";
672
661
 
673
- return m_strFileFormat;
674
- }
662
+ m_nPenColor = RGB(0,0,0);
675
663
 
676
- static int getColorFromString(const char* szColor)
677
- {
678
- if ( !szColor || !*szColor )
679
- return RGB(0, 0, 0);
664
+ if (params)
665
+ {
666
+ rho_param* p = rho_param_hash_get(params, "penColor");
667
+ if ( p )
668
+ m_nPenColor = getColorFromString(p->v.string);
669
+ }
680
670
 
681
- int c = atoi(szColor);
671
+ m_nBgColor = RGB(255,255,255);
682
672
 
683
- int cR = (c & 0xFF0000) >> 16;
684
- int cG = (c & 0xFF00) >> 8;
685
- int cB = (c & 0xFF);
673
+ if (params)
674
+ {
675
+ rho_param* p = rho_param_hash_get(params, "bgColor");
676
+ if ( p )
677
+ m_nBgColor = getColorFromString(p->v.string);
678
+ }
686
679
 
687
- return RGB(cR, cG, cB);
688
- }
680
+ m_nPenWidth = 1;
689
681
 
690
- int CRhoSignature::CParams::getPenColor()
691
- {
692
- COLORREF color = RGB(0,0,0);
682
+ if (params)
683
+ readIntFromParam(params, "penWidth", m_nPenWidth);
684
+
685
+ m_nBorder = 0;
693
686
 
694
- if (m_params)
687
+ if (params)
695
688
  {
696
- rho_param* p = rho_param_hash_get(m_params, "penColor");
697
- if ( p )
698
- color = getColorFromString(p->v.string);
689
+ rho_param* p = rho_param_hash_get(params, "border");
690
+ if ( p && (strcasecmp(p->v.string, "true") == 0 || strcasecmp(p->v.string, "1") == 0 ) )
691
+ m_nBorder = 1;
699
692
  }
700
693
 
701
- return color;
694
+ m_bSendVectors = false;
695
+
702
696
  }
703
697
 
704
- int CRhoSignature::CParams::getBgColor()
698
+ CRect CRhoSignature::CParams::getWndRect()
705
699
  {
706
- COLORREF color = RGB(255,255,255);
700
+ CRect rcDefault, rcWnd(-1,-1,-1,-1);
701
+
702
+ rcWnd.left = m_nLeft;
703
+ rcWnd.top = m_nTop;
704
+ rcWnd.right = m_nWidth;
705
+ rcWnd.right += rcWnd.left > 0 ? rcWnd.left : 0;
706
+ rcWnd.bottom = m_nHeight;
707
+ rcWnd.bottom += rcWnd.top > 0 ? rcWnd.top : 0;
707
708
 
708
- if (m_params)
709
+ if ( m_eType == esModal )
709
710
  {
710
- rho_param* p = rho_param_hash_get(m_params, "bgColor");
711
- if ( p )
712
- color = getColorFromString(p->v.string);
711
+ ::GetWindowRect(getMainWnd(), rcDefault);
712
+ }else
713
+ {
714
+ rcDefault = CRect(30, 100, 30 + 200, 100 + 150);
713
715
  }
714
716
 
715
- return color;
717
+ if (rcWnd.left == -1)
718
+ rcWnd.left = rcDefault.left;
719
+ if (rcWnd.top == -1)
720
+ rcWnd.top = rcDefault.top;
721
+ if (rcWnd.right == -1)
722
+ rcWnd.right = rcDefault.right;
723
+ if (rcWnd.bottom == -1)
724
+ rcWnd.bottom = rcDefault.bottom;
725
+
726
+ return rcWnd;
716
727
  }
717
728
 
718
- int CRhoSignature::CParams::getPenWidth()
729
+
730
+ //IRhoExtension
731
+ void CRhoSignature::onSetProperty(const wchar_t* pName, const wchar_t* pValue, const CRhoExtData& oExtData)
719
732
  {
720
- long nw = 1;
733
+ LOG(INFO) + "onSetProperty";
721
734
 
722
- if (m_params)
723
- readIntFromParam(m_params, "penWidth", nw);
735
+ if (!m_pSigWindow)
736
+ m_pSigWindow = new CRhoSignatureWindow(new CRhoSignature::CNonModalParams(false, 0));
724
737
 
725
- return (int)nw;
726
- }
738
+ CParams& oParams = m_pSigWindow->getParams();
727
739
 
728
- boolean CRhoSignature::CParams::hasBorder()
729
- {
730
- long nw = 0;
740
+ if( namecmp(pName, L"Visibility") )
741
+ {
742
+ if( namecmp(pValue, L"Visible") )
743
+ {
744
+ m_pSigWindow->Create(getWebViewWnd(0));
745
+ m_pSigWindow->ShowWindow(SW_SHOW);
746
+ }
747
+ else if( namecmp(pValue, L"Hidden"))
748
+ {
749
+ hideSignature();
750
+ }
751
+ }
752
+ else if (namecmp(pName, L"Enabled"))
753
+ {
754
+ // In order to maintain compatibility with PB2.x we also need to
755
+ // condider enabled / disabled as well as visibility.
756
+ m_pSigWindow->Create(getWebViewWnd(0));
757
+ m_pSigWindow->ShowWindow(SW_SHOW);
758
+ }
759
+ else if (namecmp(pName, L"Disabled"))
760
+ {
761
+ hideSignature();
762
+ }else if( namecmp(pName, L"Border") )
763
+ {
764
+ if( namecmp(pValue, L"Visible"))
765
+ oParams.m_nBorder = 1;
766
+ else if( namecmp(pValue, L"Hidden"))
767
+ oParams.m_nBorder = 0;
768
+ }
769
+ else if( namecmp(pName, L"Clear") )
770
+ {
771
+ m_pSigWindow->clearImage();
772
+ }
773
+ else if( namecmp(pName, L"Width"))
774
+ {
775
+ convertFromStringW( (LPCTSTR)pValue, oParams.m_nWidth );
776
+ }
777
+ else if( namecmp(pName, L"Height"))
778
+ {
779
+ convertFromStringW( (LPCTSTR)pValue, oParams.m_nHeight );
780
+ }
781
+ else if( namecmp(pName, L"Left"))
782
+ {
783
+ convertFromStringW( (LPCTSTR)pValue, oParams.m_nLeft );
784
+ }
785
+ else if( namecmp(pName, L"Top"))
786
+ {
787
+ convertFromStringW( (LPCTSTR)pValue, oParams.m_nTop );
788
+ }
789
+ else if( namecmp(pName, L"Penwidth"))
790
+ {
791
+ convertFromStringW( (LPCTSTR)pValue, oParams.m_nPenWidth );
792
+ }
793
+ else if( namecmp(pName, L"Pencolor"))
794
+ {
795
+ oParams.m_nPenColor = getColorFromMetaString( (LPCTSTR)pValue );
796
+ }
797
+ else if( namecmp( pName, L"BGColor"))
798
+ {
799
+ oParams.m_nBgColor = getColorFromMetaString( (LPCTSTR)pValue );
800
+ }
801
+ /*else if(cmp(pbMetaStructure->lpParameter, L"Destination"))
802
+ {
803
+ m_bDestinationSet = true;
804
+ if (pbMetaStructure->lpValue)
805
+ return SetIMOProperty(m_FileTransferIMO,L"Destination",pbMetaStructure->lpValue);
806
+ }*/
807
+ else if( namecmp( pName, L"Name"))
808
+ {
809
+ oParams.m_strFilePath = pValue ? convertToStringA((LPCTSTR)pValue) : "Signature";
810
+ oParams.m_strFilePath += ".bmp";
811
+ }
812
+ /*else if(cmp(pbMetaStructure->lpParameter, L"Username"))
813
+ {
814
+ if (pbMetaStructure->lpValue)
815
+ return SetIMOProperty(m_FileTransferIMO,L"UserName",pbMetaStructure->lpValue);
816
+ }
817
+ else if(cmp(pbMetaStructure->lpParameter, L"Password"))
818
+ {
819
+ if (pbMetaStructure->lpValue)
820
+ return SetIMOProperty(m_FileTransferIMO,L"Password",pbMetaStructure->lpValue);
821
+ }
822
+ else if(cmp(pbMetaStructure->lpParameter, L"Protocol"))
823
+ {
824
+ if (pbMetaStructure->lpValue)
825
+ return SetIMOProperty(m_FileTransferIMO,L"Protocol",pbMetaStructure->lpValue);
826
+ }
827
+ else if(cmp(pbMetaStructure->lpParameter, L"SignatureSaveEvent"))
828
+ {
829
+ //set the nav string for the filetransfer module
830
+ if (pbMetaStructure->lpValue)
831
+ return SetIMOProperty(m_FileTransferIMO,L"TransferEvent",pbMetaStructure->lpValue);
832
+ }*/
833
+ else if( namecmp(pName, L"VectorEvent"))
834
+ {
835
+ // Set the signature capture module to vector mode
836
+ if (pValue)
837
+ {
838
+ oParams.m_strSendVectorJS = convertToStringA((LPCTSTR)pValue);
839
+ oParams.m_bSendVectors = true;
840
+ }
841
+ }/*
842
+ else if( namecmp(pName, L"capture"))
843
+ {
844
+ // Capture will save the signature as a bitmap and transfer this
845
+ // to a remote destination if a destination parameter has been set.
846
+ // Create a Bitmap based on the Captured Signature
847
+ if(pSig->CreateDIBitmap() == FALSE)
848
+ {
849
+ return FALSE;
850
+ }
731
851
 
732
- if (m_params)
733
- {
734
- rho_param* p = rho_param_hash_get(m_params, "border");
735
- if ( p && (strcasecmp(p->v.string, "true") == 0 || strcasecmp(p->v.string, "1") == 0 ) )
736
- nw = 1;
737
- }
852
+ // Call FileTransfer Plug-in to transfer the captured bitmap to the
853
+ // specified destination.
854
+ if(m_FileTransferIMO && m_bDestinationSet)
855
+ {
856
+ TCHAR tcFormattedSource[MAXURL];
857
+ wsprintf(tcFormattedSource, L"file://\\%s", pSig->m_lpSzFilename);
858
+ if(SetIMOProperty(m_FileTransferIMO,L"Source", tcFormattedSource))
859
+ {
860
+ if(SetIMOProperty(m_FileTransferIMO,L"Overwrite",L"true"))
861
+ {
862
+ if (SetIMOProperty(m_FileTransferIMO, L"SetFileDestination", L"FALSE"))
863
+ {
864
+ return CallIMOMethod(m_FileTransferIMO,L"Transfer");
865
+ }
866
+ }
867
+ }
868
+ }
869
+ // The transfer to FileTransfer has failed
870
+ return FALSE;
871
+ }*/
872
+ else
873
+ {
874
+ // Unrecognized tag
875
+ //Log(PB_LOG_WARNING, L"Unrecognised Meta Tag Provided to Signature Capture Module", _T(__FUNCTION__), __LINE__);
876
+
877
+ }
738
878
 
739
- return nw != 0;
879
+ //TODO: process meta tags: save props to rho_param
880
+ // if action is coming like show/hide call correspondign methods
881
+ }
882
+
883
+ void CRhoSignature::onBeforeNavigate(const CRhoExtData& oExtData)
884
+ {
885
+ hideSignature();
740
886
  }
887
+ //IRhoExtension
741
888
 
742
889
  }
743
890
 
@@ -767,4 +914,13 @@ void rho_signature_clear()
767
914
  rho_callInUIThread(CRhoSignature::clearSignature, 0);
768
915
  }
769
916
 
917
+ void Init_SignatureCapture(void);
918
+ void init_rhoext_Signature()
919
+ {
920
+ Init_SignatureCapture();
921
+
922
+ RHODESAPP().getExtManager().registerExtension( "signaturecapture", new CRhoSignature() );
923
+ }
924
+
925
+
770
926
  }