{
sclint innerLoop;
CSCLUtils *utils = CSCLUtils::get_instance();
+ CSCLContext *context = CSCLContext::get_instance();
SclResParserManager *sclres_manager = SclResParserManager::get_instance();
- if (utils && sclres_manager) {
+ if (utils && sclres_manager && context) {
const PSclDefaultConfigure sclres_default_configure = sclres_manager->get_default_configure();
const PSclLayout sclres_layout = sclres_manager->get_layout_table();
const PSclLayoutKeyCoordinatePointerTable sclres_layout_key_coordinate_pointer_frame =
sclint width, height;
utils->get_screen_resolution(&width, &height);
/* If the width of screen is bigger than the height, switch portrait mode and landscape mode */
- if (width > height) {
+ if (width > height && context->get_display_mode() == DISPLAYMODE_PORTRAIT) {
invert_display = TRUE;
}
}
}
if (!(sclres_manager->loaded(layout))) {
sclres_manager->load(layout);
- resize_layout_by_resolution(layout, TRUE);
+ resize_layout_by_resolution(layout);
+ }
+ SCLDisplayMode pair_mode = ((display_mode == DISPLAYMODE_PORTRAIT) ? DISPLAYMODE_LANDSCAPE : DISPLAYMODE_PORTRAIT);
+ sclshort pair_layout = sclres_manager->get_layout_id(
+ sclres_input_mode_configure[inputmode].layouts[pair_mode]);
+ if (!(sclres_manager->loaded(pair_layout))) {
+ sclres_manager->load(pair_layout);
+ resize_layout_by_resolution(pair_layout);
}
context->set_base_layout(layout);
if (!(sclres_manager->loaded(layout))) {
sclres_manager->load(layout);
- resize_layout_by_resolution(layout, TRUE);
+ resize_layout_by_resolution(layout);
}
context->set_popup_layout(window, layout);
void set_default_row_value(Row*, const PSclLayout cur_rec_layout, const int row_y);
void set_default_key_coordinate_value(const PSclLayoutKeyCoordinate cur_rec_coordinate, const Row*);
- void free_key_coordinate_table(const PSclLayoutKeyCoordinateTable curTable);
-
void parsing_layout_row_node(const xmlNodePtr cur_node, const PSclLayout cur_rec_layout,
int *row_y, int *sub_layout_height, SclLayoutKeyCoordinatePointer **cur_key, int layout_no);
void parsing_key_coordinate_record_node(const xmlNodePtr cur_node, Row* row,
}
PSclLayout cur_rec_layout = m_layout_table + layout_id;
+
+ cur_rec_layout->name = (sclchar*)m_file_names[layout_id].c_str();
+
+ parsing_layout_node(cur_node, cur_rec_layout, layout_id);
loading_coordinate_resources(cur_node, cur_rec_layout, layout_id);
xmlFreeDoc(doc);
}
}
+ release_layout_strings();
release_key_strings();
release_upper_strings();
}
LayoutParserImpl::parsing_layout_table(const vector<string> &vec_file) {
m_file_names = vec_file;
m_layout_size = vec_file.size();
- vector<string>::const_iterator it;
- for (it = vec_file.begin(); it != vec_file.end(); it++) {
- xmlDocPtr doc;
- xmlNodePtr cur_node;
-
- string input_file = m_dir + "/" + *it;
- doc = xmlReadFile(input_file.c_str(), NULL, 0);
- if (doc == NULL) {
- SCLLOG(SclLog::DEBUG, "Could not load file: %s.", input_file.c_str());
- return -1;
- }
-
- cur_node = xmlDocGetRootElement(doc);
- if (cur_node == NULL) {
- SCLLOG(SclLog::DEBUG, "LayoutParserImpl: empty document.\n");
- xmlFreeDoc(doc);
- return -1;
- }
- if (0 != xmlStrcmp(cur_node->name, (const xmlChar*)LAYOUT_TAG))
- {
- SCLLOG(SclLog::DEBUG, "LayoutParserImpl: root name error: %s\n!", (char *)cur_node->name);
- xmlFreeDoc(doc);
- return -1;
- }
-
- int layout_id = it - vec_file.begin();
- PSclLayout cur_rec_layout = &(m_layout_table[layout_id]);
- parsing_layout_node(cur_node, cur_rec_layout, layout_id);
- cur_rec_layout->name = (sclchar*)strdup(it->c_str());
- add_layout_string((xmlChar*)cur_rec_layout->name);
- xmlFreeDoc(doc);
- }
return 0;
}