2 * Copyright 2012-2013 Samsung Electronics Co., Ltd.
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "autopopup_configure_bin_parser.h"
21 #include "put_record.h"
23 AutoPopup_Configure_Bin_Parser* AutoPopup_Configure_Bin_Parser::m_instance = NULL;
25 AutoPopup_Configure_Bin_Parser::AutoPopup_Configure_Bin_Parser() {
26 memset((void*)&m_autopopup_configure, 0x00, sizeof(SclAutoPopupConfigure));
29 AutoPopup_Configure_Bin_Parser::~AutoPopup_Configure_Bin_Parser() {
32 AutoPopup_Configure_Bin_Parser* AutoPopup_Configure_Bin_Parser::get_instance() {
33 if (m_instance == NULL) {
34 m_instance = new AutoPopup_Configure_Bin_Parser();
40 AutoPopup_Configure_Bin_Parser::decode_color(SclColor& color, int width) {
41 if (width <= 0) return;
43 color.r = m_storage.get<sint_t>(width);
44 color.g = m_storage.get<sint_t>(width);
45 color.b = m_storage.get<sint_t>(width);
46 color.a = m_storage.get<sint_t>(width);
49 void AutoPopup_Configure_Bin_Parser::init(const FileStorage& storage, int offset, int size, IParserInfo_Provider* parser_info_provider) {
50 m_storage.set_str_provider(parser_info_provider);
51 m_storage.get_storage(storage, offset, size);
52 this->parser_info_provider = parser_info_provider;
54 parsing_autopopup_configure();
57 void AutoPopup_Configure_Bin_Parser::parsing_autopopup_configure() {
58 Autopopup_configure_width record_width;
59 set_autopopup_configure_width(*parser_info_provider, record_width);
61 PSclAutoPopupConfigure cur = &m_autopopup_configure;
67 m_storage.get_str(&(cur->bg_image_path), record_width.bg_image_path, m_string_collector);
70 decode_color(cur->bg_color, record_width.bg_color);
72 cur->bg_line_width = m_storage.get<float_t>(record_width.bg_line_width);
75 decode_color(cur->bg_line_color, record_width.bg_line_color);
78 cur->bg_padding = m_storage.get<sint_t>(record_width.bg_padding);
81 for (int i = 0; i < SCL_BUTTON_STATE_MAX; ++i) {
82 m_storage.get_str(&(cur->button_image_path[i]), record_width.button_image_path, m_string_collector);
86 cur->sw_button_style = m_storage.get<sint_t>(record_width.sw_button_style);
89 cur->button_width = m_storage.get<sint_t>(record_width.button_width);
92 cur->button_height = m_storage.get<sint_t>(record_width.button_height);
95 cur->button_spacing = m_storage.get<sint_t>(record_width.button_spacing);
97 m_storage.get_str(&(cur->label_type), record_width.label_type, m_string_collector);
99 for (int i = 0; i < MAX_WND_DECORATOR; ++i) {
100 m_storage.get_str(&(cur->decoration_image_path[i]), record_width.decoration_image_path, m_string_collector);
104 cur->decoration_size = m_storage.get<sint_t>(record_width.decoration_size);
107 cur->max_column = m_storage.get<sint_t>(record_width.max_column);
110 cur->add_grab_left = m_storage.get<sint_t>(record_width.add_grab_left);
113 cur->add_grab_right = m_storage.get<sint_t>(record_width.add_grab_right);
116 cur->add_grab_top = m_storage.get<sint_t>(record_width.add_grab_top);
119 cur->add_grab_bottom = m_storage.get<sint_t>(record_width.add_grab_bottom);
120 #ifdef __SCL_TXT_DEBUG
121 put_autopopup_configure(DECODE, m_autopopup_configure);
125 PSclAutoPopupConfigure AutoPopup_Configure_Bin_Parser::get_autopopup_configure() {
126 return &m_autopopup_configure;