/** Exporte l'element en XML @param all_parts Booleen (a vrai par defaut) indiquant si le XML genere doit representer tout l'element ou seulement les elements selectionnes @return un document XML decrivant l'element */ const QDomDocument ElementScene::toXml(bool all_parts) { QRectF size= elementSceneGeometricRect(); //if the element doesn't contains the origin point of the scene //we move the element to the origin for solve this default before saving if (!size.contains(0,0) && all_parts) { centerElementToOrigine(); //recalcul the size after movement size= elementSceneGeometricRect(); } //define the size of the element by the upper multiple of 10 int upwidth = ((qRound(size.width())/10)*10)+10; if ((qRound(size.width())%10) > 6) upwidth+=10; int upheight = ((qRound(size.height())/10)*10)+10; if ((qRound(size.height())%10) > 6) upheight+=10; //the margin between the real size of the element and the rectangle that delimits int xmargin = qRound(upwidth - size.width()); int ymargin = qRound(upheight - size.height()); // document XML QDomDocument xml_document; // racine du document XML QDomElement root = xml_document.createElement("definition"); root.setAttribute("type", "element"); root.setAttribute("width", QString("%1").arg(upwidth)); root.setAttribute("height", QString("%1").arg(upheight)); root.setAttribute("hotspot_x", QString("%1").arg(-(qRound(size.x() - (xmargin/2))))); root.setAttribute("hotspot_y", QString("%1").arg(-(qRound(size.y() - (ymargin/2))))); root.setAttribute("orientation", "dyyy"); //we keep the orientation for compatibility with previous version of qet root.setAttribute("version", QET::version); root.setAttribute("link_type", m_elmt_type); // noms de l'element root.appendChild(_names.toXml(xml_document)); if (m_elmt_type == "slave" || m_elmt_type == "master") { QDomElement kindInfo = xml_document.createElement("kindInformations"); m_elmt_kindInfo.toXml(kindInfo, "kindInformation"); root.appendChild(kindInfo); } // informations complementaires de l'element QDomElement informations_element = xml_document.createElement("informations"); root.appendChild(informations_element); informations_element.appendChild(xml_document.createTextNode(informations())); QDomElement description = xml_document.createElement("description"); // description de l'element foreach(QGraphicsItem *qgi, zItems()) { // si l'export ne concerne que la selection, on ignore les parties non selectionnees if (!all_parts && !qgi -> isSelected()) continue; if (CustomElementPart *ce = dynamic_cast<CustomElementPart *>(qgi)) { if (ce -> isUseless()) continue; description.appendChild(ce -> toXml(xml_document)); } } root.appendChild(description); xml_document.appendChild(root); return(xml_document); }
/******************************************************************** * * * Gestion du menu * * * ********************************************************************/ boolean MenuSelect(int object, int scan, int state, int button) { int index, entree, key; if (object < 0) { /* attend qu'on relache la souris */ NoClick(); if (button < 0) { /* regarde la touche */ key = scantoascii(scan); if (key == 0) key = scan & 0xFF00; /* scan code */ else key = UpperChar(key); for (index = 0; index < NbMenus; index++) for (entree = 0; entree < MenuShortCuts[index].nb_entrees; entree++) if (MenuShortCuts[index].menu[entree].key == key && MenuShortCuts[index].menu[entree].state == state) { if (ob_isstate(Menu, MenuShortCuts[index].menuid, DISABLED) == 0 && ob_isstate(Menu, MenuShortCuts[index].menu[entree].itemid, DISABLED) == 0) { object = MenuShortCuts[index].menu[entree].itemid; index = NbMenus; } break; } } } if (object < 0) return FALSE; /* kein entsprechender Eintrag gefunden */ /* Men�punkte 'Fenster wechseln' und 'Fenster schliežen' werden inklusive der dazugeh”rigen Hotkeys automatisch verwaltet */ switch (object) { /* menu Zorg */ case INFORMATIONS: presentation(); break; /* menu Etat */ case INFORMATION: informations(Drive); break; case REPERTOIRE_LOUPE: if (ManageVFAT) open_directory_vfat(); else open_directory_short(); break; case TEST_STRUCTURE: if (ManageVFAT) structure_test_vfat(Drive); else structure_test_short(Drive); break; case STATISTIQUES: statistiques(Drive); break; case OCCUPATION: occupation(Drive); break; case TRACE_UN_FICHIER: trace_file(); break; case QUITTER: if (Reset) { if (my_alert(1, 2, X_ICN_QUESTION, Messages(MENU_1), Messages(BOOT_32)) == 0) shutdown(TRUE); } else { button = my_alert(2, 3, X_ICN_QUESTION, Messages(MENU_2), Messages(MENU_4)); if (button == 0 || button == 1 && (int)xbios(0x11) % 2) shutdown(FALSE); } break; /* menu Ouvre */ case UNITE_LOGIQUE: open_disk(); break; case OUVRE_DISQUETTE: raw_floppy(FALSE); break; case OUVRE_DISQUE_DUR: raw_hard(FALSE); break; case OUVRE_FICHIER: open_file(); break; case OUVRE_FICHIER_FS: open_file_other_fs(); break; case OUVRE_FICH_TEXTE: voir_fichier(); break; case CREER_FICHIER: creer_fichier(); break; case FERMER: fermer(Thefrontwin -> win -> handle); break; case LIRE_BOOT: lire_boot(); break; case CHARGER_BOOT: charger_boot(); break; case SAUVER_BOOT: sauver_boot(); break; case ECRIRE_BOOT: #ifdef TEST_VERSION /* relache la souris */ NoClick(); /* on attend avant de redessiner */ Event_Timer(0, 0, TRUE); my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL); #else ecrire_boot(); #endif break; /* menu Edition */ case SAUVER_SECTEUR: #ifdef TEST_VERSION /* relache la souris */ NoClick(); /* on attend avant de redessiner */ Event_Timer(0, 0, TRUE); my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL); #else save_secteur(Thefrontwin, MENU_EDITION); #endif break; case COPIER_SECTEUR: copier_tampon(Thefrontwin); break; case COLLER_SECTEUR: coller_tampon(Thefrontwin); break; case ECHANGER_TAMPON: echanger_tampon(Thefrontwin); break; case RETOUR_INITIAL: load_secteur(Thefrontwin, MENU_EDITION); break; case OUVRIR_TAMPON: ouvrir_tampon(); break; case SAUVER_TAMPON: sauver_tampon(); break; case CHARGER_TB_ASCII: ascii_tampon(); break; case EFFACER_TAMPON: effacer_tampon(); break; /* menu Structure */ case DEFRAGMENTATION: #ifdef TEST_VERSION /* relache la souris */ NoClick(); /* on attend avant de redessiner */ Event_Timer(0, 0, TRUE); my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL); #else reconnect(Drive); #endif break; case UNIQUE_LIBRE: #ifdef TEST_VERSION /* relache la souris */ NoClick(); /* on attend avant de redessiner */ Event_Timer(0, 0, TRUE); my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL); #else compresse(Drive); #endif break; case RESTO_COMPLETE: #ifdef TEST_VERSION /* relache la souris */ NoClick(); /* on attend avant de redessiner */ Event_Timer(0, 0, TRUE); my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL); #else restauration_complete(Drive); #endif break; case VIDE_CLST_LIBRES: nettoie_clusters_libres(Drive); break; case NETTOIE_REPERTOI: #ifdef TEST_VERSION /* relache la souris */ NoClick(); /* on attend avant de redessiner */ Event_Timer(0, 0, TRUE); my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL); #else nettoie_repertoire(Drive); #endif break; /* menu Deplacement */ case SECTEUR_SUIVANT: next_secteur(Thefrontwin); break; case SECTEUR_PRECEDEN: previous_secteur(Thefrontwin); break; case BLOC_SUIVANT: next_bloc(Thefrontwin); break; case BLOC_PRECEDENT: previous_bloc(Thefrontwin); break; case MARQUER_POSITION: marquer_position(Thefrontwin); break; case ALLER_MARQUE: goto_marque(Thefrontwin); break; case ALLER_SECTEUR: goto_secteur(Thefrontwin); break; case CHERCHER_CHAINE: search_first(Thefrontwin); break; case CHERCHER_NOUVEAU: search_next(Thefrontwin); break; /* menu Fenˆtres */ case CHOIX_FONTE: choix_fonte(Thefrontwin); break; case CHOIX_COULEURS: couleur(Thefrontwin); break; case TAILLE_IDEALE: taille_ideale(Thefrontwin); break; case ASCENSEURS: ascenseurs(Thefrontwin); break; case CYCLER_FENETRES: cycle_window(); break; case WINDOW_LIST_1: case WINDOW_LIST_2: case WINDOW_LIST_3: case WINDOW_LIST_4: case WINDOW_LIST_5: case WINDOW_LIST_6: case WINDOW_LIST_7: case WINDOW_LIST_8: case WINDOW_LIST_9: case WINDOW_LIST_10: { windowptr thewin; for (thewin = Firstwindow; thewin; thewin = thewin -> next) if (thewin -> menu_entry == object - WINDOW_LIST_1) make_frontwin(thewin); } break; /* menu Options */ case CONFIG_GENERALE: config_generale(); break; case CONFIG_DSK: config_disques(); break; case RACCOURCIS_CLAVI: raccourcis_clavier(); break; case DONNEES_ZORG: from_zorg_inf(TRUE); break; case DONNEES_SYSTEME: from_zorg_inf(FALSE); break; case INVALIDE_CACHE: if (Kbshift(FAIL) & 4) { int i; for (i=0; i<MAX_DEVICES; i++) change_disque(i, FALSE); } else change_disque(Drive, TRUE); break; case UPDATE_SYSTEME: if (Kbshift(FAIL) & 4) { int i; for (i=0; i<MAX_DEVICES; i++) update_systeme(i); } else update_systeme(Drive); break; case VISU_TEXTE: really_voir_fichier(Thefrontwin -> fonction.fichier.nom); break; case VISU_ASCII: secteur_ascii(Thefrontwin); break; case VISU_HEXA: secteur_hexa(Thefrontwin); break; case AFFICHE_DECIMAL: affichage_decimal(Thefrontwin); break; case FICHIER_ASSOCIE: secteur_file(Thefrontwin); break; case CURSEUR_VISIBLE: curseur_on(Thefrontwin); break; case CLIPBOARD_GEM: clipboard_gem(Thefrontwin); break; /* menu Aide */ case TABLE_ASCII: AsciiChar = m_ascii_box(AsciiChar, FALSE); break; case AIDE: aide(); break; case EXECUTER_PROG: lance_prg(); break; case RESET: if (Reset) { Reset = FALSE; menu_icheck(Menu, RESET, 0); } else { int button; button = my_alert(2, 3, X_ICN_QUESTION, Messages(MENU_3), Messages(MENU_5)); if (button == 1) shutdown(TRUE); else if (button == 0) reset(); } break; } return TRUE; } /* MenuSelect */