const float halfSizeofPlane = 0.5f;
const float cubeHeight = 0.5;
+#define PORTRAIT
+
+#ifdef PORTRAIT
+const float leftTransform[16] = {
+ 0.0f, -1.0f, 0.0f, 0.0f,
+ -1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, -1.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.2f
+};
+#else
const float leftTransform[16] = {
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, -1.0f, 0.0f, 0.0f,
0.0f, 0.0f, -1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.2f
};
+#endif
+
+#ifdef PORTRAIT
+const float rightTransform[16] = {
+ 0.0f, -1.0f, 0.0f, 0.0f,
+ -1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, -1.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 2.0f
+};
+#else
const float rightTransform[16] = {
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, -1.0f, 0.0f, 0.0f,
0.0f, 0.0f, -1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 2.0f
};
+#endif
const float aVertices[] =
{
+++ /dev/null
-//
-// Tizen Native SDK
-// Open Service Platform
-// Copyright (c) 2013 Samsung Electronics Co., Ltd.
-// All rights reserved.
-//
-// This software contains confidential and proprietary information
-// of Samsung Electronics Co., Ltd.
-// The user of this software agrees not to disclose, disseminate or copy such
-// Confidential Information and shall use the software only in accordance with
-// the terms of the license agreement the user entered into with Samsung.
-//
-
-
-#ifndef _PANELBUTTON_H_
-#define _PANELBUTTON_H_
-
-#include <FBase.h>
-#include <FUi.h>
-
-#include "Tracker.h"
-
-class PanelButton
- : public Tizen::Ui::Controls::Panel
-{
-public:
- PanelButton(void);
- virtual ~PanelButton(void);
- bool Initialize(Tizen::Ui::IActionEventListener*);
- result OnInitializing(void);
- result OnTerminating(void);
-
- static const int ID_BUTTON_EXECUTE = 503;
- static const int ID_BUTTON_EXIT = 504;
- static const int ID_BUTTON_HIDE = 505;
-
-private:
- Tizen::Ui::IActionEventListener* __pButtonListener;
-};
-
-#endif // _PANELBUTTON_H_
#include "TouchForm.h"
#include "Tracker.h"
-#include "PanelButton.h"
#include "ControlManager.h"
: public Tizen::App::UiApp
, public Tizen::System::IScreenEventListener
, public Tizen::Ui::IActionEventListener
+ , public Tizen::Ui::Controls::IFormBackEventListener
{
public:
static Tizen::App::Application* CreateInstance(void);
virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+ void OnFormBackRequested(Tizen::Ui::Controls::Form &source);
+
private:
void ExecuteQr(Tizen::Base::String);
Tracker* __pTracker;
TouchForm* __pForm;
- PanelButton* __pPanel;
ControlManager* __pControlManager;
Tizen::Ui::Controls::Popup* __pPopup;
#include <FBase.h>
#include <FUi.h>
-#include "PanelButton.h"
class TouchForm
: public Tizen::Ui::Controls::Form
- , public Tizen::Ui::ITouchEventListener
{
public:
-
TouchForm(void);
virtual ~TouchForm(void);
- bool Initialize(void);
+ bool Initialize(Tizen::Ui::Controls::IFormBackEventListener* back, Tizen::Ui::IActionEventListener* load);
public:
-
virtual result OnInitializing(void);
virtual result OnTerminating(void);
- virtual void OnTouchLongPressed(const Tizen::Ui::Control &source, const Tizen::Graphics::Point ¤tPosition, const Tizen::Ui::TouchEventInfo &touchInfo);
- virtual void OnTouchMoved(const Tizen::Ui::Control &source, const Tizen::Graphics::Point ¤tPosition, const Tizen::Ui::TouchEventInfo &touchInfo);
- virtual void OnTouchPressed(const Tizen::Ui::Control &source, const Tizen::Graphics::Point ¤tPosition, const Tizen::Ui::TouchEventInfo &touchInfo);
- virtual void OnTouchReleased(const Tizen::Ui::Control &source, const Tizen::Graphics::Point ¤tPosition, const Tizen::Ui::TouchEventInfo &touchInfo);
- virtual void OnTouchDoublePressed(const Tizen::Ui::Control &source, const Tizen::Graphics::Point ¤tPosition, const Tizen::Ui::TouchEventInfo &touchInfo);
- virtual void OnTouchFocusIn(const Tizen::Ui::Control &source, const Tizen::Graphics::Point ¤tPosition, const Tizen::Ui::TouchEventInfo &touchInfo);
- virtual void OnTouchFocusOut(const Tizen::Ui::Control &source, const Tizen::Graphics::Point ¤tPosition, const Tizen::Ui::TouchEventInfo &touchInfo);
-
virtual void OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs);
- static const RequestId REQUEST_EXIT = 555;
- static const RequestId REQUEST_SHOW_TEXT = 55;
static const RequestId REQUEST_ACTIVATE = 100;
static const RequestId REQUEST_DEACTIVATE = 101;
+ static const int ID_BUTTON_EXECUTE = 503;
+
private:
void Activate(void);
void Deactivate(void);
- PanelButton* __pPanel;
+ Tizen::Ui::Controls::IFormBackEventListener* __pBackListener;
+ Tizen::Ui::IActionEventListener* __pLoadListener;
+
};
#endif // _TOUCHFORM_H_
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- This XML file was automatically generated by UiBuilder - do not modify by hand.
--->
-<!DOCTYPE ScenePanel SYSTEM "UIForm.dtd">
-<ScenePanel Bversion="3.0.0.201302011734" Dversion="20120315">
- <Panel id="IDC_BUTTON_PANEL">
- <property backgroundColor="" backgroundColorOpacity="0" compositeEnabled="true" groupStyle="GROUP_STYLE_NONE"/>
- <layout height="720" mode="Portrait" type="LAYOUT_VERTICAL_BOX" verticalDirection="VERTICAL_DIRECTION_DOWNWARD" width="800" x="0" y="0"/>
- <layout height="720" mode="Landscape" type="LAYOUT_VERTICAL_BOX" verticalDirection="VERTICAL_DIRECTION_DOWNWARD" width="300" x="0" y="0"/>
- </Panel>
-</ScenePanel>
This XML file was automatically generated by UiBuilder - do not modify by hand.
-->
<!DOCTYPE Scene SYSTEM "UIForm.dtd">
-<Scene Bversion="2.0.0.201302151552" Dversion="20120315">
+<Scene Bversion="2.0.0.201303182057" Dversion="20120315">
<LogicalCoordinate>720</LogicalCoordinate>
<Form id="IDF_FORM">
- <property backgroundColor="" backgroundColorOpacity="100" orientation="Landscape" softKey0NormalIcon="" softKey0PressedIcon="" softKey0Text="" softKey1NormalIcon="" softKey1PressedIcon="" softKey1Text="" title="" titleAlign="ALIGN_LEFT" titleIcon="" translucentFooter="false" translucentHeader="false" translucentIndicator="false"/>
- <layout mode="Landscape" style="FORM_STYLE_NORMAL" type="LAYOUT_RELATIVE"/>
+ <property backgroundColor="" backgroundColorOpacity="100" notificationTrayOpenEnabled="false" orientation="Portrait" softKey0NormalIcon="" softKey0PressedIcon="" softKey0Text="" softKey1NormalIcon="" softKey1PressedIcon="" softKey1Text="" title="" titleAlign="ALIGN_CENTER" titleIcon="" translucentFooter="false" translucentHeader="false" translucentIndicator="false"/>
+ <layout mode="Portrait" style="FORM_STYLE_FOOTER" type="NONE"/>
+ <layout mode="Landscape" style="FORM_STYLE_FOOTER" type="NONE"/>
</Form>
- <Label id="IDC_INFO_LABEL" parent="IDF_FORM">
- <property backgroundBitmapPath="" backgroundColor="" backgroundColorOpacity="0" horizontalAlign="ALIGN_LEFT" text="" textColor="Blue" textSize="33" textStyle="LABEL_TEXT_STYLE_NORMAL" verticalAlign="ALIGN_TOP"/>
- <layout bottomRelation="" bottomRelationType="" centerHorizontal="false" centerVertical="false" height="500" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="IDF_FORM" leftRelationType="RECT_EDGE_RELATION_LEFT_TO_LEFT" marginBottom="0" marginLeft="20" marginRight="0" marginTop="20" mode="Landscape" rightRelation="" rightRelationType="" topRelation="IDF_FORM" topRelationType="RECT_EDGE_RELATION_TOP_TO_TOP" verticalFitPolicy="FIT_POLICY_FIXED" width="1237" x="20" y="20"/>
- <layout bottomRelation="" bottomRelationType="" centerHorizontal="false" centerVertical="false" height="165" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0" marginLeft="0" marginRight="0" marginTop="0" mode="Portrait" rightRelation="" rightRelationType="" topRelation="" topRelationType="" verticalFitPolicy="FIT_POLICY_FIXED" width="168" x="20" y="65"/>
+ <Footer>
+ <property backgroundBitmapPath="" color="" colorOpacity="0" disabledButtonColor="" disabledButtonColorOpacity="0" disabledButtonTextColor="" disabledItemColor="" disabledItemColorOpacity="0" disabledItemTextColor="" footerStyle="FOOTER_STYLE_BUTTON_TEXT" highlightedButtonColor="" highlightedButtonColorOpacity="0" highlightedButtonTextColor="" highlightedItemColor="" highlightedItemColorOpacity="0" highlightedItemTextColor="" normalButtonColor="" normalButtonColorOpacity="0" normalButtonTextColor="" normalItemColor="" normalItemColorOpacity="0" normalItemTextColor="" pressedButtonColor="" pressedButtonColorOpacity="0" pressedButtonTextColor="" pressedItemColor="" pressedItemColorOpacity="0" pressedItemTextColor="" selectedItemColor="" selectedItemColorOpacity="0" selectedItemTextColor="" showBackButton="true"/>
+ <itemSet/>
+ </Footer>
+ <Label id="IDC_INFO_LABEL" parent="IDF_FORM">
+ <property accessibilityHint="" backgroundBitmapPath="" backgroundColor="" backgroundColorOpacity="0" horizontalAlign="ALIGN_LEFT" leftMargin="16" text="Label1" textColor="Blue" textSize="33.0" textStyle="LABEL_TEXT_STYLE_NORMAL" topMargin="0" verticalAlign="ALIGN_TOP"/>
+ <layout height="276.0" mode="Portrait" width="677.0" x="20.0" y="65.0"/>
+ <layout height="43.0" mode="Landscape" width="1237.0" x="20.0" y="20.0"/>
</Label>
</Scene>
+++ /dev/null
-//
-// Tizen Native SDK
-// Open Service Platform
-// Copyright (c) 2013 Samsung Electronics Co., Ltd.
-// All rights reserved.
-//
-// This software contains confidential and proprietary information
-// of Samsung Electronics Co., Ltd.
-// The user of this software agrees not to disclose, disseminate or copy such
-// Confidential Information and shall use the software only in accordance with
-// the terms of the license agreement the user entered into with Samsung.
-//
-
-#include <FApp.h>
-#include "PanelButton.h"
-
-using namespace Tizen::Base;
-using namespace Tizen::Ui;
-using namespace Tizen::Ui::Controls;
-
-
-PanelButton::PanelButton(void)
- : __pButtonListener(0)
-{
-}
-
-PanelButton::~PanelButton(void)
-{
-}
-
-bool
-PanelButton::Initialize(Tizen::Ui::IActionEventListener* listener)
-{
- Panel::Construct("IDC_BUTTON_PANEL");
- __pButtonListener = listener;
- return true;
-}
-
-result
-PanelButton::OnInitializing(void)
-{
- result r = E_SUCCESS;
-
- Button *pButtonExecute = new Button();
- pButtonExecute->Construct(Tizen::Graphics::Rectangle(0, 0, this->GetWidth(), this->GetHeight() / 3), "Process QR");
- pButtonExecute->SetActionId(ID_BUTTON_EXECUTE);
- pButtonExecute->AddActionEventListener(*__pButtonListener);
- this->AddControl(*pButtonExecute);
-
- Button *pButtonExit = new Button();
- pButtonExit->Construct(Tizen::Graphics::Rectangle(0, 0, this->GetWidth(), this->GetHeight() / 3), "Exit");
- pButtonExit->SetActionId(ID_BUTTON_EXIT);
- pButtonExit->AddActionEventListener(*__pButtonListener);
- this->AddControl(*pButtonExit);
-
- Button *pButtonHide = new Button();
- pButtonHide->Construct(Tizen::Graphics::Rectangle(0, 0, this->GetWidth(), this->GetHeight() / 3), "Hide");
- pButtonHide->SetActionId(ID_BUTTON_HIDE);
- pButtonHide->AddActionEventListener(*__pButtonListener);
- this->AddControl(*pButtonHide);
-
- return r;
-}
-
-result
-PanelButton::OnTerminating(void)
-{
- result r = E_SUCCESS;
- return r;
-}
QrCodeRecognizer::QrCodeRecognizer()
: __pTracker(0)
, __pForm(0)
- , __pPanel(0)
, __pControlManager(0)
, __pPopup(0)
{
pAppFrame->Construct();
AddFrame(*pAppFrame);
- pAppFrame->SetOrientation(Tizen::Ui::ORIENTATION_LANDSCAPE);
+ //pAppFrame->SetOrientation(Tizen::Ui::ORIENTATION_PORTRAIT);
// Creates an instance of Popup
__pPopup = new Tizen::Ui::Controls::Popup();
__pPopup->Construct(true, Tizen::Graphics::Dimension(570, 250));
- __pPanel = new PanelButton();
- __pPanel->Initialize(this);
- __pPanel->SetBounds(pAppFrame->GetHeight() - pAppFrame->GetHeight() / 5, 0, pAppFrame->GetHeight() / 5, pAppFrame->GetWidth());
-
__pForm = new TouchForm();
- __pForm->Initialize();
- __pForm->AddControl(*__pPanel);
+ __pForm->Initialize(this, this);
pAppFrame->AddControl(*__pForm);
GLtools::initGL(__pForm);
__pForm->SendUserEvent(TouchForm::REQUEST_ACTIVATE, null);
{
switch(actionId)
{
- case PanelButton::ID_BUTTON_HIDE:
- {
- __pPanel->SetEnabled(false);
- __pPanel->SetShowState(false);
- }
- break;
- case PanelButton::ID_BUTTON_EXIT:
- {
- __pPopup->SetShowState(true);
- __pPopup->Show();
- }
- break;
- case PanelButton::ID_BUTTON_EXECUTE:
+ case TouchForm::ID_BUTTON_EXECUTE:
{
if(__pTracker)
{
}
}
}
+
+void
+QrCodeRecognizer::OnFormBackRequested(Tizen::Ui::Controls::Form &source)
+{
+ __pPopup->SetShowState(true);
+ __pPopup->Show();
+}
Renderer::Draw(void)
{
+#ifdef PORTRAIT
+ float glScale = (float)GLtools::getHeight() / GLtools::getWidth();
+#else
float glScale = (float)GLtools::getWidth() / GLtools::getHeight();
+#endif
float cScale = (float)CameraTools::GetWidth() / CameraTools::GetHeight();
float scaleWidth = 1.0f;
GLfloat vVertices[] = {
+#ifdef PORTRAIT
+ 1.0f , 1.0f , 0.0f, // Position 3
+#else
-1.0f , 1.0f , 0.0f, // Position 0
- 0.0f , heightShift , // TexCoord 0
+#endif
+ 0.0f , heightShift , // TexCoord 0
0.f , 0.0f , 0.0f, // Color
- -1.0f , -1.0f, 0.0f , // Position 1
- 0.0f , scaleHeight + heightShift, // TexCoord 1
- 0.0f , 0.f , 0.f, // Color
-
+#ifdef PORTRAIT
+ -1.0f , 1.0f , 0.0f, // Position 0
+#else
+ -1.0f , -1.0f , 0.0f, // Position 1
+#endif
+ 0.0f , scaleHeight + heightShift, // TexCoord 1
+ 0.0f , 0.f , 0.0f, // Color
+
+#ifdef PORTRAIT
+ -1.0f , -1.0f , 0.0f, // Position 1
+#else
1.0f , -1.0f, 0.0f, // Position 2
- scaleWidth + widthShift, scaleHeight + heightShift, // TexCoord 2
+#endif
+ scaleWidth + widthShift, scaleHeight + heightShift, // TexCoord 2
0.0f , 0.0f , 0.0f, // Color
- 1.0f , 1.0f , 0.0f, // Position 3
+#ifdef PORTRAIT
+ 1.0f , -1.0f, 0.0f, // Position 2
+#else
+ 1.0f , 1.0f , 0.0f, // Position 3
+#endif
scaleWidth + widthShift, heightShift , // TexCoord 3
- 0.0f , 0.0f , 0.0f // Color
+ 0.0f , 0.0f , 0.0f // Color
};
P[i] = 0.0f;
}
+#ifdef PORTRAIT
+ P[0] = float(f / aspect);
+ P[5] = float(f);
+#else
P[0] = float(f);
P[5] = float(f * aspect);
+#endif
+
P[10] = float((znear + zfar) / (znear - zfar));
P[11] = -1.0f;
P[14] = float((2.0 * znear * zfar) / (znear - zfar));
#include "TouchForm.h"
TouchForm::TouchForm(void)
- : __pPanel(0)
{
}
}
bool
-TouchForm::Initialize(void)
+TouchForm::Initialize(Tizen::Ui::Controls::IFormBackEventListener* back, Tizen::Ui::IActionEventListener* load)
{
Construct(L"IDF_FORM");
+ __pBackListener = back;
+ __pLoadListener = load;
+
return true;
}
TouchForm::OnInitializing(void)
{
result r = E_SUCCESS;
- AddTouchEventListener(*this);
- __pPanel = static_cast<PanelButton*>(GetControl("IDC_BUTTON_PANEL"));
+ Tizen::Ui::Controls::Footer* pFooter = GetFooter();
+
+ Tizen::Ui::Controls::FooterItem pFooterItemMain;
+ pFooterItemMain.Construct(ID_BUTTON_EXECUTE);
+ pFooterItemMain.SetText(L"Process Qr");
+ pFooter->AddItem(pFooterItemMain);
+
+ pFooter->AddActionEventListener(*__pLoadListener);
+ SetFormBackEventListener(__pBackListener);
return r;
}
}
void
-TouchForm::OnTouchLongPressed(const Tizen::Ui::Control &source, const Tizen::Graphics::Point ¤tPosition, const Tizen::Ui::TouchEventInfo &touchInfo)
-{
-}
-
-void
-TouchForm::OnTouchMoved(const Tizen::Ui::Control &source, const Tizen::Graphics::Point ¤tPosition, const Tizen::Ui::TouchEventInfo &touchInfo)
-{
-}
-
-void
-TouchForm::OnTouchPressed(const Tizen::Ui::Control &source, const Tizen::Graphics::Point ¤tPosition, const Tizen::Ui::TouchEventInfo &touchInfo)
-{
-}
-
-void
-TouchForm::OnTouchReleased(const Tizen::Ui::Control &source, const Tizen::Graphics::Point ¤tPosition, const Tizen::Ui::TouchEventInfo &touchInfo)
-{
- static int __clicked = 0;
- if (3 <= __clicked)
- {
- if (__pPanel)
- {
- if (!__pPanel->GetShowState())
- {
- __pPanel->SetEnabled(true);
- __pPanel->SetShowState(true);
- }
- }
- __clicked = 0;
- }
- ++__clicked;
-}
-
-void
-TouchForm::OnTouchDoublePressed(const Tizen::Ui::Control &source, const Tizen::Graphics::Point ¤tPosition, const Tizen::Ui::TouchEventInfo &touchInfo)
-{
-}
-
-void
-TouchForm::OnTouchFocusIn(const Tizen::Ui::Control &source, const Tizen::Graphics::Point ¤tPosition, const Tizen::Ui::TouchEventInfo &touchInfo)
-{
-}
-
-void
-TouchForm::OnTouchFocusOut(const Tizen::Ui::Control &source, const Tizen::Graphics::Point ¤tPosition, const Tizen::Ui::TouchEventInfo &touchInfo)
-{
-}
-
-void
TouchForm::Activate(void)
{
this->SetShowState(true);
Tizen::Ui::Controls::Frame *pFrame = Tizen::App::Application::GetInstance()->GetAppFrame()->GetFrame();
pFrame->SetCurrentForm(*this);
this->RequestRedraw(true);
- AddTouchEventListener(*this);
}
void
{
this->SetEnabled(false);
this->SetShowState(false);
- RemoveTouchEventListener(*this);
}
void