1 //------------------------------------------------------------------------------
2 // emTmpConvModelClient.cpp
3 //
4 // Copyright (C) 2007-2008 Oliver Hamann.
5 //
6 // Homepage: http://eaglemode.sourceforge.net/
7 //
8 // This program is free software: you can redistribute it and/or modify it under
9 // the terms of the GNU General Public License version 3 as published by the
10 // Free Software Foundation.
11 //
12 // This program is distributed in the hope that it will be useful, but WITHOUT
13 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 // FOR A PARTICULAR PURPOSE. See the GNU General Public License version 3 for
15 // more details.
16 //
17 // You should have received a copy of the GNU General Public License version 3
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 //------------------------------------------------------------------------------
20 
21 #include <emTmpConv/emTmpConvModelClient.h>
22 
23 
emTmpConvModelClient(emTmpConvModel * model)24 emTmpConvModelClient::emTmpConvModelClient(emTmpConvModel * model)
25 {
26 	ConversionWanted=false;
27 	Priority=0.0;
28 	ThisPtrInList=NULL;
29 	NextInList=NULL;
30 	if (model) SetModel(model);
31 }
32 
33 
~emTmpConvModelClient()34 emTmpConvModelClient::~emTmpConvModelClient()
35 {
36 	SetModel(NULL);
37 }
38 
39 
SetModel(emTmpConvModel * model)40 void emTmpConvModelClient::SetModel(emTmpConvModel * model)
41 {
42 	if (Model==model) return;
43 	if (Model) {
44 		*ThisPtrInList=NextInList;
45 		if (NextInList) NextInList->ThisPtrInList=ThisPtrInList;
46 		ThisPtrInList=NULL;
47 		NextInList=NULL;
48 		Model->ClientsChanged();
49 		Model=NULL;
50 	}
51 	if (model) {
52 		Model=model;
53 		NextInList=Model->ClientList;
54 		if (NextInList) NextInList->ThisPtrInList=&NextInList;
55 		Model->ClientList=this;
56 		ThisPtrInList=&Model->ClientList;
57 		Model->ClientsChanged();
58 	}
59 }
60 
61 
SetConversionWanted(bool conversionWanted)62 void emTmpConvModelClient::SetConversionWanted(bool conversionWanted)
63 {
64 	if (ConversionWanted!=conversionWanted) {
65 		ConversionWanted=conversionWanted;
66 		if (Model) Model->ClientsChanged();
67 	}
68 }
69 
70 
SetPriority(double priority)71 void emTmpConvModelClient::SetPriority(double priority)
72 {
73 	if (Priority!=priority) {
74 		Priority=priority;
75 		if (Model) Model->ClientsChanged();
76 	}
77 }
78