Last change
on this file since 555 was
286,
checked in by Maciej Komosinski, 10 years ago
|
Updated headers
|
-
Property svn:eol-style set to
native
|
File size:
1.3 KB
|
Rev | Line | |
---|
[286] | 1 | // This file is a part of Framsticks SDK. http://www.framsticks.com/ |
---|
| 2 | // Copyright (C) 1999-2015 Maciej Komosinski and Szymon Ulatowski. |
---|
| 3 | // See LICENSE.txt for details. |
---|
[109] | 4 | |
---|
| 5 | #include <common/nonstd.h> |
---|
| 6 | #include "syntparam.h" |
---|
| 7 | #include "paramobj.h" |
---|
| 8 | #include <math.h> |
---|
| 9 | |
---|
| 10 | SyntParam::SyntParam(ParamEntry *init_pe,SString* autostr,bool handle_defaults_when_saving) |
---|
| 11 | :autostring(autostr) |
---|
| 12 | { |
---|
| 13 | Param::setParamTab(init_pe); |
---|
| 14 | pe=ParamObject::makeParamTab(this); |
---|
| 15 | Param::setParamTab(pe); |
---|
| 16 | if (handle_defaults_when_saving) |
---|
| 17 | { |
---|
| 18 | def_obj=ParamObject::makeObject(pe); |
---|
| 19 | Param::select(def_obj); |
---|
| 20 | Param::setDefault(); |
---|
| 21 | } |
---|
| 22 | else |
---|
| 23 | def_obj=NULL; |
---|
| 24 | obj=ParamObject::makeObject(pe); |
---|
| 25 | Param::select(obj); |
---|
| 26 | Param::setDefault(); |
---|
| 27 | revert(); |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | SyntParam::SyntParam(const SyntParam& src) |
---|
| 31 | :Param(),autostring(src.autostring) |
---|
| 32 | { |
---|
| 33 | Param::setParamTab(src.pe); |
---|
| 34 | pe=ParamObject::makeParamTab(this); |
---|
| 35 | Param::setParamTab(pe); |
---|
| 36 | obj=ParamObject::dupObject(src.obj); |
---|
| 37 | def_obj=src.def_obj ? ParamObject::dupObject(src.def_obj) : NULL; |
---|
| 38 | Param::select(obj); |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | SyntParam::~SyntParam() |
---|
| 42 | { |
---|
| 43 | update(); |
---|
| 44 | ParamObject::freeParamTab(pe); |
---|
| 45 | ParamObject::freeObject(obj); |
---|
| 46 | ParamObject::freeObject(def_obj); |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | void SyntParam::update(SString *s) |
---|
| 50 | { |
---|
| 51 | if (!s) s=autostring; |
---|
| 52 | if (s) {*s=""; Param::save2(*s,def_obj,0);} |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | void SyntParam::revert(SString *s) |
---|
| 56 | { |
---|
| 57 | if (!s) s=autostring; |
---|
| 58 | if (s) { |
---|
| 59 | int p=0; |
---|
| 60 | Param::load2(*s,p); |
---|
| 61 | } |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | |
---|
Note: See
TracBrowser
for help on using the repository browser.