From e7e89e342ecd9a5d0e29cf2a56f7aad70fd520fa Mon Sep 17 00:00:00 2001 From: Kyusung Cho Date: Sat, 13 Apr 2013 13:42:25 +0900 Subject: [PATCH] resource id addition Change-Id: I60da8f79a3b054377c901bbba9aa283fec6c8c09 Signed-off-by: Kyusung Cho --- project/inc/AppResourceId.h | 38 ++++++++++++++++++++++++++++++++++++++ project/src/AppResourceId.cpp | 35 +++++++++++++++++++++++++++++++++++ project/src/FeatureManagerForm.cpp | 7 ++++--- project/src/GeneratePanel.cpp | 19 ++++++++++--------- project/src/MainForm.cpp | 21 +++++++++++---------- project/src/UpdatePanel.cpp | 19 ++++++++++--------- 6 files changed, 108 insertions(+), 31 deletions(-) create mode 100644 project/inc/AppResourceId.h create mode 100644 project/src/AppResourceId.cpp diff --git a/project/inc/AppResourceId.h b/project/inc/AppResourceId.h new file mode 100644 index 0000000..4a7bf65 --- /dev/null +++ b/project/inc/AppResourceId.h @@ -0,0 +1,38 @@ +// +// Tizen C++ SDK +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.tizenopensource.org/license +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#ifndef _APP_RESOURCE_ID_H_ +#define _APP_RESOURCE_ID_H_ + +extern const wchar_t* IDF_FORM; +extern const wchar_t* IDC_CHOOSE_MODE_PANEL; +extern const wchar_t* IDC_GENERATION_MODE_BUTTON; +extern const wchar_t* IDC_UPDATE_MODE_BUTTON; +extern const wchar_t* IDC_UPDATE_MODE_PANEL; +extern const wchar_t* IDC_FEATURE_SET_PATH_LABEL; +extern const wchar_t* IDC_BUTTON_LOAD_FEATURE_SET; +extern const wchar_t* IDC_MESSAGE_POPUP; +extern const wchar_t* IDC_LABEL_MASSEGE_TEXT; +extern const wchar_t* IDC_BUTTON_MESSAGE_CLOSE; +extern const wchar_t* IDC_GENERATION_MODE_PANEL; +extern const wchar_t* IDC_BUTTON_CHOOSE_FEATURE_SET_PATH; +extern const wchar_t* IDC_BUTTON_CHOOSE_IMAGE_FOLDER; +extern const wchar_t* IDC_CHOOSE_IMAGE_FOLDER_LABEL; +extern const wchar_t* IDC_CREATE_FEATRUE_SET_LABEL; + +#endif // _APP_RESOURCE_ID_H_ + diff --git a/project/src/AppResourceId.cpp b/project/src/AppResourceId.cpp new file mode 100644 index 0000000..458f388 --- /dev/null +++ b/project/src/AppResourceId.cpp @@ -0,0 +1,35 @@ +// +// Tizen C++ SDK +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.tizenopensource.org/license +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#include "AppResourceId.h" + +const wchar_t* IDF_FORM = L"IDF_FORM"; +const wchar_t* IDC_CHOOSE_MODE_PANEL = L"IDC_CHOOSE_MODE_PANEL"; +const wchar_t* IDC_GENERATION_MODE_BUTTON = L"IDC_GENERATION_MODE_BUTTON"; +const wchar_t* IDC_UPDATE_MODE_BUTTON = L"IDC_UPDATE_MODE_BUTTON"; +const wchar_t* IDC_UPDATE_MODE_PANEL = L"IDC_UPDATE_MODE_PANEL"; +const wchar_t* IDC_FEATURE_SET_PATH_LABEL = L"IDC_FEATURE_SET_PATH_LABEL"; +const wchar_t* IDC_BUTTON_LOAD_FEATURE_SET = L"IDC_BUTTON_LOAD_FEATURE_SET"; +const wchar_t* IDC_MESSAGE_POPUP = L"IDC_MESSAGE_POPUP"; +const wchar_t* IDC_LABEL_MASSEGE_TEXT = L"IDC_LABEL_MASSEGE_TEXT"; +const wchar_t* IDC_BUTTON_MESSAGE_CLOSE = L"IDC_BUTTON_MESSAGE_CLOSE"; +const wchar_t* IDC_GENERATION_MODE_PANEL = L"IDC_GENERATION_MODE_PANEL"; +const wchar_t* IDC_BUTTON_CHOOSE_FEATURE_SET_PATH = L"IDC_BUTTON_CHOOSE_FEATURE_SET_PATH"; +const wchar_t* IDC_BUTTON_CHOOSE_IMAGE_FOLDER = L"IDC_BUTTON_CHOOSE_IMAGE_FOLDER"; +const wchar_t* IDC_CHOOSE_IMAGE_FOLDER_LABEL = L"IDC_CHOOSE_IMAGE_FOLDER_LABEL"; +const wchar_t* IDC_CREATE_FEATRUE_SET_LABEL = L"IDC_CREATE_FEATRUE_SET_LABEL"; + diff --git a/project/src/FeatureManagerForm.cpp b/project/src/FeatureManagerForm.cpp index 0eba471..f14a8c0 100644 --- a/project/src/FeatureManagerForm.cpp +++ b/project/src/FeatureManagerForm.cpp @@ -15,6 +15,7 @@ // limitations under the License. // +#include "AppResourceId.h" #include "FeatureManagerForm.h" #include "MainForm.h" @@ -94,7 +95,7 @@ void FeatureManagerForm::OnActionPerformed (const Tizen::Ui::Control &source, int actionId) { Tizen::Ui::Controls::Frame *pFrame = Tizen::App::Application::GetInstance()->GetAppFrame()->GetFrame(); - MainForm* pForm = static_cast(pFrame->GetControl(L"IDF_FORM", true)); + MainForm* pForm = static_cast(pFrame->GetControl(IDF_FORM, true)); SceneManager* pSceneManager = SceneManager::GetInstance(); AppAssert(pSceneManager); @@ -132,7 +133,7 @@ int FeatureManagerForm::GetItemCount(void) { Tizen::Ui::Controls::Frame *pFrame = Tizen::App::Application::GetInstance()->GetAppFrame()->GetFrame(); - MainForm* pForm = static_cast(pFrame->GetControl(L"IDF_FORM", true)); + MainForm* pForm = static_cast(pFrame->GetControl(IDF_FORM, true)); if (pForm) { @@ -158,7 +159,7 @@ FeatureManagerForm::CreateItem(int index) { IconListViewItem* pIconListViewItem = new IconListViewItem(); Tizen::Ui::Controls::Frame *pFrame = Tizen::App::Application::GetInstance()->GetAppFrame()->GetFrame(); - MainForm* pForm = static_cast(pFrame->GetControl(L"IDF_FORM", true)); + MainForm* pForm = static_cast(pFrame->GetControl(IDF_FORM, true)); if (pForm->GetFeatureManager()) { const Tizen::Uix::Vision::ImageFeatureInfo* pFeature = pForm->GetFeatureManager()->GetImageFeatureInfo(index); diff --git a/project/src/GeneratePanel.cpp b/project/src/GeneratePanel.cpp index d4b2fba..5e2eb69 100644 --- a/project/src/GeneratePanel.cpp +++ b/project/src/GeneratePanel.cpp @@ -15,6 +15,7 @@ // limitations under the License. // +#include "AppResourceId.h" #include "GeneratePanel.h" #include "MainForm.h" #include "FileManagerForm.h" @@ -40,7 +41,7 @@ GeneratePanel::~GeneratePanel(void) bool GeneratePanel::Initialize() { - Panel::Construct(L"IDC_GENERATION_MODE_PANEL"); + Panel::Construct(IDC_GENERATION_MODE_PANEL); return true; } @@ -51,19 +52,19 @@ GeneratePanel::OnInitializing(void) Button *pButton = null; Tizen::Ui::Controls::Frame *pFrame = Tizen::App::Application::GetInstance()->GetAppFrame()->GetFrame(); - MainForm* pForm = static_cast(pFrame->GetControl(L"IDF_FORM", true)); + MainForm* pForm = static_cast(pFrame->GetControl(IDF_FORM, true)); Rectangle clienRect = pForm->GetClientAreaBounds(); this->SetBounds(clienRect); - pButton = static_cast(GetControl(L"IDC_BUTTON_CHOOSE_IMAGE_FOLDER", true)); + pButton = static_cast(GetControl(IDC_BUTTON_CHOOSE_IMAGE_FOLDER, true)); if (pButton) { pButton->SetActionId(ID_BUTTON_CHOOSE_IMAGE_FOLDER_PATH); pButton->AddActionEventListener(*this); } - pButton = static_cast(GetControl(L"IDC_BUTTON_CHOOSE_FEATURE_SET_PATH", true)); + pButton = static_cast(GetControl(IDC_BUTTON_CHOOSE_FEATURE_SET_PATH, true)); if (pButton) { pButton->SetActionId(ID_BUTTON_CHOOSE_FEATURE_SET_PATH); @@ -140,13 +141,13 @@ GeneratePanel::OnSceneActivatedN( } Label* pLabel = null; - pLabel = static_cast(GetControl(L"IDC_CREATE_FEATRUE_SET_LABEL", true)); + pLabel = static_cast(GetControl(IDC_CREATE_FEATRUE_SET_LABEL, true)); if (pLabel) { pLabel->SetText(__currentFeaturePath); } - pLabel = static_cast(GetControl(L"IDC_CHOOSE_IMAGE_FOLDER_LABEL", true)); + pLabel = static_cast(GetControl(IDC_CHOOSE_IMAGE_FOLDER_LABEL, true)); if (pLabel) { pLabel->SetText(__currentImagePath); @@ -164,7 +165,7 @@ void GeneratePanel::OnImageProcessed(int imNo, int total) { Tizen::Ui::Controls::Frame *pFrame = Tizen::App::Application::GetInstance()->GetAppFrame()->GetFrame(); - MainForm* pForm = static_cast(pFrame->GetControl(L"IDF_FORM", true)); + MainForm* pForm = static_cast(pFrame->GetControl(IDF_FORM, true)); pForm->OnImageProcessed(imNo, total); } @@ -173,7 +174,7 @@ void GeneratePanel::OnFinish(void) { Tizen::Ui::Controls::Frame *pFrame = Tizen::App::Application::GetInstance()->GetAppFrame()->GetFrame(); - MainForm* pForm = static_cast(pFrame->GetControl(L"IDF_FORM", true)); + MainForm* pForm = static_cast(pFrame->GetControl(IDF_FORM, true)); result res = pForm->GetFeatureManager()->Flush(&__currentFeaturePath); @@ -190,7 +191,7 @@ GeneratePanel::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection case GeneratePanel::REQUEST_GENERATE_FEATURE_SET: { Tizen::Ui::Controls::Frame *pFrame = Tizen::App::Application::GetInstance()->GetAppFrame()->GetFrame(); - MainForm* pForm = static_cast(pFrame->GetControl(L"IDF_FORM", true)); + MainForm* pForm = static_cast(pFrame->GetControl(IDF_FORM, true)); pForm->GetFeatureManager()->DeleteAllFeatures(); pForm->AppendImageFolder(__currentImagePath, this); break; diff --git a/project/src/MainForm.cpp b/project/src/MainForm.cpp index 96fe146..38b9fbf 100644 --- a/project/src/MainForm.cpp +++ b/project/src/MainForm.cpp @@ -16,6 +16,7 @@ // #include +#include "AppResourceId.h" #include "MainForm.h" #include "FileManagerForm.h" #include "GeneratePanel.h" @@ -51,7 +52,7 @@ MainForm::~MainForm(void) bool MainForm::Initialize(void) { - Construct(L"IDF_FORM"); + Construct(IDF_FORM); return true; } @@ -67,7 +68,7 @@ MainForm::OnInitializing(void) __pRadioGroupMode = new RadioGroup(); __pRadioGroupMode->Construct(); - pCheckButton = static_cast(GetControl(L"IDC_UPDATE_MODE_BUTTON", true)); + pCheckButton = static_cast(GetControl(IDC_UPDATE_MODE_BUTTON, true)); if (pCheckButton) { pCheckButton->AddActionEventListener(*this); @@ -75,7 +76,7 @@ MainForm::OnInitializing(void) __pRadioGroupMode->Add(*pCheckButton); } - pCheckButton = static_cast(GetControl(L"IDC_GENERATION_MODE_BUTTON", true)); + pCheckButton = static_cast(GetControl(IDC_GENERATION_MODE_BUTTON, true)); if (pCheckButton) { @@ -102,8 +103,8 @@ MainForm::OnInitializing(void) __pFeatureManager->Construct(); __pMessagePopup = new Popup(); - __pMessagePopup->Construct("IDC_MESSAGE_POPUP"); - __pMessageLabel = static_cast(__pMessagePopup->GetControl("IDC_LABEL_MASSEGE_TEXT", true)); + __pMessagePopup->Construct(IDC_MESSAGE_POPUP); + __pMessageLabel = static_cast(__pMessagePopup->GetControl(IDC_LABEL_MASSEGE_TEXT, true)); __pContextMenu = new ContextMenu(); __pContextMenu->Construct(Point(50, 1200), CONTEXT_MENU_STYLE_LIST); @@ -112,7 +113,7 @@ MainForm::OnInitializing(void) __pContextMenu->AddItem(L"Delete Features", ID_CONTEXT_MENU_DELETE); __pContextMenu->AddActionEventListener(*this); - Button* pButton = static_cast(__pMessagePopup->GetControl("IDC_BUTTON_MESSAGE_CLOSE", true)); + Button* pButton = static_cast(__pMessagePopup->GetControl(IDC_BUTTON_MESSAGE_CLOSE, true)); if (pButton) { pButton->AddActionEventListener(*this); @@ -202,7 +203,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) case ID_FOOTER_ITEM_GENERATE: { - Panel* pPanel = static_cast(this->GetControl("IDC_GENERATION_MODE_PANEL", true)); + Panel* pPanel = static_cast(this->GetControl(IDC_GENERATION_MODE_PANEL, true)); if (pPanel) { pPanel->SendUserEvent(GeneratePanel::REQUEST_GENERATE_FEATURE_SET, null); @@ -211,7 +212,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) break; case ID_FOOTER_ITEM_UPDATE: { - Panel* pPanel = static_cast(this->GetControl("IDC_UPDATE_MODE_PANEL", true)); + Panel* pPanel = static_cast(this->GetControl(IDC_UPDATE_MODE_PANEL, true)); if (pPanel) { pPanel->SendUserEvent(UpdatePanel::REQUEST_UPDATE, null); @@ -226,7 +227,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) break; case ID_CONTEXT_MENU_ADD: { - Panel* pPanel = static_cast(this->GetControl("IDC_UPDATE_MODE_PANEL", true)); + Panel* pPanel = static_cast(this->GetControl(IDC_UPDATE_MODE_PANEL, true)); if (pPanel) { pPanel->SendUserEvent(UpdatePanel::REQUEST_ADD, null); @@ -235,7 +236,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) break; case ID_CONTEXT_MENU_DELETE: { - Panel* pPanel = static_cast(this->GetControl("IDC_UPDATE_MODE_PANEL", true)); + Panel* pPanel = static_cast(this->GetControl(IDC_UPDATE_MODE_PANEL, true)); if (pPanel) { pPanel->SendUserEvent(UpdatePanel::REQUEST_DELETE, null); diff --git a/project/src/UpdatePanel.cpp b/project/src/UpdatePanel.cpp index 9642de3..ab8518f 100644 --- a/project/src/UpdatePanel.cpp +++ b/project/src/UpdatePanel.cpp @@ -15,6 +15,7 @@ // limitations under the License. // +#include "AppResourceId.h" #include "UpdatePanel.h" #include "FileManagerForm.h" #include "MainForm.h" @@ -40,7 +41,7 @@ UpdatePanel::~UpdatePanel(void) bool UpdatePanel::Initialize() { - Panel::Construct(L"IDC_UPDATE_MODE_PANEL"); + Panel::Construct(IDC_UPDATE_MODE_PANEL); return true; } @@ -51,12 +52,12 @@ UpdatePanel::OnInitializing(void) Button *pButton = null; Tizen::Ui::Controls::Frame *pFrame = Tizen::App::Application::GetInstance()->GetAppFrame()->GetFrame(); - MainForm* pForm = static_cast(pFrame->GetControl(L"IDF_FORM", true)); + MainForm* pForm = static_cast(pFrame->GetControl(IDF_FORM, true)); Rectangle clienRect = pForm->GetClientAreaBounds(); this->SetBounds(clienRect); - pButton = static_cast(GetControl(L"IDC_BUTTON_LOAD_FEATURE_SET", true)); + pButton = static_cast(GetControl(IDC_BUTTON_LOAD_FEATURE_SET, true)); if (pButton) { pButton->SetActionId(ID_BUTTON_LOAD_FEATURE_SET); @@ -102,7 +103,7 @@ UpdatePanel::OnSceneActivatedN( { Tizen::Ui::Controls::Frame *pFrame = Tizen::App::Application::GetInstance()->GetAppFrame()->GetFrame(); - MainForm* pForm = static_cast(pFrame->GetControl(L"IDF_FORM", true)); + MainForm* pForm = static_cast(pFrame->GetControl(IDF_FORM, true)); Footer* pFooter = pForm->GetFooter(); if ((previousSceneId == "ChooseImageScene") && pArgs) @@ -166,7 +167,7 @@ UpdatePanel::OnSceneActivatedN( Label* pLabel = null; - pLabel = static_cast(GetControl(L"IDC_FEATURE_SET_PATH_LABEL", true)); + pLabel = static_cast(GetControl(IDC_FEATURE_SET_PATH_LABEL, true)); if (pLabel) { pLabel->SetText(__currentFeaturePath); @@ -194,7 +195,7 @@ void UpdatePanel::OnImageProcessed(int imNo, int total) { Tizen::Ui::Controls::Frame *pFrame = Tizen::App::Application::GetInstance()->GetAppFrame()->GetFrame(); - MainForm* pForm = static_cast(pFrame->GetControl(L"IDF_FORM", true)); + MainForm* pForm = static_cast(pFrame->GetControl(IDF_FORM, true)); pForm->OnImageProcessed(imNo, total); } @@ -203,7 +204,7 @@ void UpdatePanel::OnFinish(void) { Tizen::Ui::Controls::Frame *pFrame = Tizen::App::Application::GetInstance()->GetAppFrame()->GetFrame(); - MainForm* pForm = static_cast(pFrame->GetControl(L"IDF_FORM", true)); + MainForm* pForm = static_cast(pFrame->GetControl(IDF_FORM, true)); __currentImagePath = ""; Button* pButtonPath = static_cast(GetControl(L"IDC_BUTTON_UPDATE_IMAGE_FOLDER", true)); @@ -243,7 +244,7 @@ UpdatePanel::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection:: case UpdatePanel::REQUEST_MESSAGE_AFTER_DELETE: { Tizen::Ui::Controls::Frame *pFrame = Tizen::App::Application::GetInstance()->GetAppFrame()->GetFrame(); - MainForm* pForm = static_cast(pFrame->GetControl(L"IDF_FORM", true)); + MainForm* pForm = static_cast(pFrame->GetControl(IDF_FORM, true)); Tizen::Base::String message; message.Format(80, L"Deleted %i features.", __prevFeaturesCount - pForm->GetFeatureManager()->GetTotalNumberOfFeatures()); @@ -278,7 +279,7 @@ UpdatePanel::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection:: case UpdatePanel::REQUEST_UPDATE: { Tizen::Ui::Controls::Frame *pFrame = Tizen::App::Application::GetInstance()->GetAppFrame()->GetFrame(); - MainForm* pForm = static_cast(pFrame->GetControl(L"IDF_FORM", true)); + MainForm* pForm = static_cast(pFrame->GetControl(IDF_FORM, true)); //Disabling update button Footer* pFooter = pForm->GetFooter(); -- 2.7.4