annotate edtlobj.cpp @ 379:05e85401480a

Rename eddemoobj to edtlobj, etc.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 17 Oct 2012 03:40:30 +0300
parents eddemoobj.cpp@feaeec4c6c55
children 9993873ff655
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 //
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 // Map Mask Designer -- Map object and map region classes
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 // (C) Copyright 2012 Matti 'ccr' Hämäläinen <ccr@tnsp.org>
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 //
379
05e85401480a Rename eddemoobj to edtlobj, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 378
diff changeset
5 #include "edtlobj.h"
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 #include "dmres.h"
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8
378
feaeec4c6c55 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
9 TimelineObject::TimelineObject()
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 {
378
feaeec4c6c55 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
11 tl = NULL;
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 changed = 0;
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 }
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15
378
feaeec4c6c55 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
16 TimelineObject::TimelineObject(TimelineObject *obj)
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 {
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 changed = 0;
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 filename = obj->filename;
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 }
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22
378
feaeec4c6c55 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
23 TimelineObject::~TimelineObject()
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 {
379
05e85401480a Rename eddemoobj to edtlobj, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 378
diff changeset
25 dmFreeTimeline(tl);
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 }
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27
379
05e85401480a Rename eddemoobj to edtlobj, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 378
diff changeset
28
378
feaeec4c6c55 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
29 int TimelineObject::load(QString mfilename)
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 {
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 QByteArray fnba = mfilename.toUtf8();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 DMResource *res;
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 if ((res = dmf_create_stdio(fnba.data(), "rb")) == NULL)
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 return DMERR_FOPEN;
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35
378
feaeec4c6c55 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
36 int err = dmLoadTimeline(res, &tl);
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 dmf_close(res);
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 filename = mfilename;
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 return err;
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 }
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43
378
feaeec4c6c55 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
44 int TimelineObject::save(QString mfilename)
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45 {
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 QByteArray fnba = mfilename.toUtf8();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 DMResource *res;
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 if ((res = dmf_create_stdio(fnba.data(), "wb")) == NULL)
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 return DMERR_FOPEN;
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50
378
feaeec4c6c55 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
51 int err = dmSaveTimeline(res, tl);
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 dmf_close(res);
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 return err;
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55 }