SPDocument::SPDocument() : keepalive(FALSE), virgin(TRUE), modified_since_save(FALSE), rdoc(0), rroot(0), root(0), style_cascade(cr_cascade_new(NULL, NULL, NULL)), uri(0), base(0), name(0), priv(0), // reset in ctor actionkey(0), modified_id(0), profileManager(0), // deferred until after other initialization router(new Avoid::Router()), perspectives(0), current_persp3d(0), _collection_queue(0) { // Don't use the Consolidate moves optimisation. router->ConsolidateMoves = false; SPDocumentPrivate *p = new SPDocumentPrivate(); p->serial = next_serial++; p->iddef = g_hash_table_new(g_direct_hash, g_direct_equal); p->reprdef = g_hash_table_new(g_direct_hash, g_direct_equal); p->resources = g_hash_table_new(g_str_hash, g_str_equal); p->sensitive = FALSE; p->partial = NULL; p->history_size = 0; p->undo = NULL; p->redo = NULL; p->seeking = false; priv = p; // Once things are set, hook in the manager profileManager = new Inkscape::ProfileManager(this); // XXX only for testing! priv->undoStackObservers.add(p->console_output_undo_observer); }
/** * cr_om_parser_parse_paths_to_cascade: *@a_this: the current instance of #CROMParser *@a_author_path: the path to the author stylesheet *@a_user_path: the path to the user stylesheet *@a_ua_path: the path to the User Agent stylesheet *@a_encoding: the encoding of the sheets. *@a_result: out parameter. The resulting cascade if the parsing *was okay * *Parses three sheets located by their paths and build a cascade * *Returns CR_OK upon successful completion, an error code otherwise */ enum CRStatus cr_om_parser_parse_paths_to_cascade (CROMParser * a_this, const guchar * a_author_path, const guchar * a_user_path, const guchar * a_ua_path, enum CREncoding a_encoding, CRCascade ** a_result) { enum CRStatus status = CR_OK; /*0->author sheet, 1->user sheet, 2->UA sheet */ CRStyleSheet *sheets[3]; guchar *paths[3]; CRCascade *result = NULL; gint i = 0; g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR); memset (sheets, 0, sizeof (CRStyleSheet*) * 3); paths[0] = (guchar *) a_author_path; paths[1] = (guchar *) a_user_path; paths[2] = (guchar *) a_ua_path; for (i = 0; i < 3; i++) { status = cr_om_parser_parse_file (a_this, paths[i], a_encoding, &sheets[i]); if (status != CR_OK) { if (sheets[i]) { cr_stylesheet_unref (sheets[i]); sheets[i] = NULL; } continue; } } result = cr_cascade_new (sheets[0], sheets[1], sheets[2]); if (!result) { for (i = 0; i < 3; i++) { cr_stylesheet_unref (sheets[i]); sheets[i] = 0; } return CR_ERROR; } *a_result = result; return CR_OK; }