2 * Copyright (c) 2012 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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 "encode_magnifier_configure.h"
19 #include "xmlresource.h"
20 #include "resource_storage_impl.h"
21 #include "put_record.h"
22 #include "_auto_metadata.h"
23 using namespace xmlresource;
25 encode_magnifier_configure_record(ResourceStorage& storage, const PSclMagnifierWndConfigure cur, const Magnifier_configure_width& record_width) {
27 storage.put<sint_t>(cur->style, record_width.style);
29 storage.put<sint_t>(cur->width, record_width.width);
31 storage.put<sint_t>(cur->height, record_width.height);
32 //label_area_record.left
33 storage.put<sint_t>(cur->label_area_rect.left, record_width.label_area_rect);
34 //label_area_rect.right
35 storage.put<sint_t>(cur->label_area_rect.right, record_width.label_area_rect);
37 //label_area_record.top
38 storage.put<sint_t>(cur->label_area_rect.top, record_width.label_area_rect);
39 //label_area_rect.bottom
40 storage.put<sint_t>(cur->label_area_rect.bottom, record_width.label_area_rect);
42 storage.encode_string(cur->bg_image_path, record_width.bg_image_path);
45 storage.encode_string(cur->bg_shift_image_path, record_width.bg_shift_image_path);
47 //bg_shift_lock_image_path
48 storage.encode_string(cur->bg_shift_lock_image_path, record_width.bg_shift_lock_image_path);
50 //bg_long_key_image_path
51 storage.encode_string(cur->bg_long_key_image_path, record_width.bg_long_key_image_path);
53 storage.put<sint_t>(cur->use_actual_window, record_width.use_actual_window);
55 storage.encode_string(cur->label_type, record_width.label_type);
57 storage.put<sint_t>(cur->padding_x, record_width.padding_x);
59 storage.put<sint_t>(cur->padding_y, record_width.padding_y);
61 storage.put<sint_t>(cur->show_shift_label, record_width.show_shift_label);
65 encode_magnifier_configure_file(ResourceStorage& storage, IMetaData_Helper& md_helper) {
66 int init_size = storage.get_size();
68 XMLResource *xmlresource = XMLResource::get_instance();
69 PSclMagnifierWndConfigure magnifierConfigure = xmlresource->get_magnifier_configure();
72 #ifdef __SCL_TXT_DEBUG
73 put_magnifier_wnd_configure(ENCODE, *magnifierConfigure);
76 Magnifier_configure_width record_width;
77 set_magnifier_configure_width(md_helper, record_width);
80 encode_magnifier_configure_record(storage, magnifierConfigure, record_width);
82 int advance_size = storage.get_size() - init_size;
84 storage.random_put<sint_t>(advance_size, 8, init_size);
86 return storage.get_size();
90 encode_magnifier_configure_file(const char* file, int& offset, IMetaData_Helper& md_helper) {
94 ResourceStorage storage;
95 encode_magnifier_configure_file(storage, md_helper);
96 storage.toFile(file, offset);
98 return storage.get_size();
102 encode_magnifier_configure_file(const char* file, IMetaData_Helper& md_helper) {
106 ResourceStorage storage;
107 encode_magnifier_configure_file(storage, md_helper);
108 storage.toFile(file);
110 return storage.get_size();