source: cpp/frams/param/syntparam.cpp @ 215

Last change on this file since 215 was 197, checked in by Maciej Komosinski, 11 years ago

GDK used by developers since 1999, distributed on the web since 2002

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1// This file is a part of the Framsticks GDK.
2// Copyright (C) 1999-2014  Maciej Komosinski and Szymon Ulatowski.  See LICENSE.txt for details.
3// Refer to http://www.framsticks.com/ for further information.
4
5#include <common/nonstd.h>
6#include "syntparam.h"
7#include "paramobj.h"
8#include <math.h>
9
10SyntParam::SyntParam(ParamEntry *init_pe,SString* autostr,bool handle_defaults_when_saving)
11        :autostring(autostr)
12{
13Param::setParamTab(init_pe);
14pe=ParamObject::makeParamTab(this);
15Param::setParamTab(pe);
16if (handle_defaults_when_saving)
17        {
18        def_obj=ParamObject::makeObject(pe);
19        Param::select(def_obj);
20        Param::setDefault();
21        }
22else
23        def_obj=NULL;
24obj=ParamObject::makeObject(pe);
25Param::select(obj);
26Param::setDefault();
27revert();
28}
29
30SyntParam::SyntParam(const SyntParam& src)
31        :Param(),autostring(src.autostring)
32{
33Param::setParamTab(src.pe);
34pe=ParamObject::makeParamTab(this);
35Param::setParamTab(pe);
36obj=ParamObject::dupObject(src.obj);
37def_obj=src.def_obj ? ParamObject::dupObject(src.def_obj) : NULL;
38Param::select(obj);
39}
40
41SyntParam::~SyntParam()
42{
43update();
44ParamObject::freeParamTab(pe);
45ParamObject::freeObject(obj);
46ParamObject::freeObject(def_obj);
47}
48
49void SyntParam::update(SString *s)
50{
51if (!s) s=autostring;
52if (s) {*s=""; Param::save2(*s,def_obj,0);}
53}
54
55void SyntParam::revert(SString *s)
56{
57if (!s) s=autostring;
58if (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.