File: PROTOCOL\TProtocolTopographyManagePrintDlg.cpp
1 //******************************************************************************
2 //Datei : TProtocolTopographyManagePrintDlg.cpp
3 //Projekt : XCTL
4 //Subsystem : Protokollbuch
5 //Autor : Jens Klier <klier@informatik.hu-berlin.de>
6 // Institut fuer Informatik,
7 // Humboldt-Universitaet Berlin
8 //Inhalt : Implementation der Klasse TProtocolTopographyManagePrintDlg
9 //******************************************************************************
10 //!neu klier Protokollbuch
11 #include "internls\evrythng.h"
12 #include "winresrc\rc_prtow.h" // Ressourcen-IDs
13 #include <commdlg.h>
14 #include <commctrl.h>
15
16 #include "protocol\TProtocolLanguage.h"
17 #include "protocol\TProtocol.h"
18 #include "protocol\TProtocolDlg.h"
19 #include "protocol\TProtocolTopography.h"
20 #include "protocol\TProtocolTopographyDlg.h"
21 #include "protocol\TProtocolManagePrintDlg.h"
22 #include "protocol\TProtocolTopographyManagePrintDlg.h"
23
24 //--||--\\--||--//--||--\\--||--//--||--\\--||--//--||--\\--||--//--||--\\--||--
25
26 extern TProtocolLanguage *ProtocolLanguage;
27 extern TProtocolTopography *ProtocolTopography;
28 extern HINSTANCE hModuleInstance;
29
30 TProtocolTopographyManagePrintDlg::TProtocolTopographyManagePrintDlg(LPSTR Dlg, TProtocolTopographyDlg *ProtocolTopographyDlg, int x, int y, TModelessDlg **aRef) :
31 TProtocolManagePrintDlg(Feldelemente, x, y), TModelessDlg(Dlg, aRef, hModuleInstance)
32 {
33 Protocol= ProtocolTopography;
34 ProtocolCombobox.InitializeManageComboboxProtocolDlg(Protocol);
35 ProtocolDlg= ProtocolTopographyDlg;
36 };
37
38 BOOL TProtocolTopographyManagePrintDlg::Dlg_OnInit(HWND hwnd, HWND hwndCtl, LPARAM lParam)
39 {
40 int iCol=0;
41 char buf[MaxString];
42
43 TProtocolManagePrintDlg::Dlg_OnInit(hwnd, hwndCtl, lParam);
44 ProtocolCombobox.InitializeCombobox(hwnd, hLieferantList, id_PrnLieferant, Lieferant, "Lieferant");
45 ProtocolCombobox.InitializeCombobox(hwnd, hMaterialList, id_PrnMaterial, Material, "Material");
46
47 if (!PListView_InsertColumn(hSuchList, iCol++, ProtocolTopography->GetParameterNamen(LfdNr, buf)))
48 return FALSE;
49 if (!PListView_InsertColumn(hSuchList, iCol++, "-"))
50 return FALSE;
51 if (!PListView_InsertColumn(hSuchList, iCol++, ProtocolTopography->GetParameterNamen(RTKNr, buf)))
52 return FALSE;
53 if (!PListView_InsertColumn(hSuchList, iCol++, ProtocolTopography->GetParameterNamen(Datum, buf)))
54 return FALSE;
55 if (!PListView_InsertColumn(hSuchList, iCol++, ProtocolTopography->GetParameterNamen(ProbenNr, buf)))
56 return FALSE;
57 if (!PListView_InsertColumn(hSuchList, iCol++, ProtocolTopography->GetParameterNamen(Lieferant, buf)))
58 return FALSE;
59 if (!PListView_InsertColumn(hSuchList, iCol++, ProtocolTopography->GetParameterNamen(Material, buf)))
60 return FALSE;
61
62 ListView_SetExtendedListViewStyle(hSuchList, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES );
63
64 ProtocolLanguage->SetTopographyManagePrintDlgLanguage(hwnd);
65
66 return TRUE;
67 };
68
69 void TProtocolTopographyManagePrintDlg::Dlg_OnNotify(HWND hwnd, int message, UINT id, UINT wParam)
70 {
71 TProtocolManagePrintDlg::Dlg_OnNotify(hwnd, message, id, wParam);
72 };
73
74 void TProtocolTopographyManagePrintDlg::Dlg_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
75 {
76 if (TProtocolManagePrintDlg::Dlg_OnCommand(hwnd, id, codeNotify))
77 return;
78
79 TModelessDlg::Dlg_OnCommand(hwnd, id, hwndCtl, codeNotify);
80 };
81
82 LPSTR TProtocolTopographyManagePrintDlg::GetDlgItemText_LfdNr( HWND hwnd, LPSTR lLfdNr )
83 {
84 char buf[MaxString];
85
86 GetDlgItemText(hwnd, id_PrnLfdNrBereich, lLfdNr, MaxString);
87 GetDlgItemText(hwnd, id_PrnLfdNr, buf, MaxString);
88 strcat(lLfdNr, buf);
89 return lLfdNr;
90 };
91
92 void TProtocolTopographyManagePrintDlg::GetDlgItemText_SearchParameter( HWND hwnd, TSearchParameter SearchParameter )
93 {
94 GetDlgItemText(hwnd, id_PrnRTKNr, SearchParameter[0], MaxString);
95 GetDlgItemText(hwnd, id_PrnProbenNr, SearchParameter[1], MaxString);
96 GetDlgItemText(hwnd, id_PrnLieferant, SearchParameter[2], MaxString);
97 GetDlgItemText(hwnd, id_PrnMaterial, SearchParameter[3], MaxString);
98 };
99
100 BOOL TProtocolTopographyManagePrintDlg::SearchProtocolString( LPCSTR lLfdNr, const TSearchDate SearchDate, const TSearchParameter SearchParameter )
101 {
102 return ProtocolTopography->SearchProtocolString(lLfdNr, SearchParameter[0], SearchDate[0], SearchDate[1],
103 SearchParameter[1], SearchParameter[2], SearchParameter[3]);
104 };
105
106 void TProtocolTopographyManagePrintDlg::MakeListString( int iIndex )
107 {
108 char buf[MaxString];
109 int iCol=1;
110
111 PListView_InsertItem(hSuchList, iIndex, ProtocolTopography->GetProtocolValue(LfdNr, buf));
112
113 PListView_SetItemText(hSuchList, iIndex, iCol++, "-");
114 PListView_SetItemText(hSuchList, iIndex, iCol++, ProtocolTopography->GetProtocolValue(RTKNr, buf));
115 PListView_SetItemText(hSuchList, iIndex, iCol++, ProtocolTopography->GetProtocolValue(Datum, buf));
116 PListView_SetItemText(hSuchList, iIndex, iCol++, ProtocolTopography->GetProtocolValue(ProbenNr, buf));
117 PListView_SetItemText(hSuchList, iIndex, iCol++, ProtocolTopography->GetProtocolValue(Lieferant, buf));
118 PListView_SetItemText(hSuchList, iIndex, iCol++, ProtocolTopography->GetProtocolValue(Material, buf));
119 };
120
121 int TProtocolTopographyManagePrintDlg::GetPages( int SelCount )
122 {
123 int i;
124
125 if (SelCount % 3 > 0)
126 i= 1;
127 else
128 i= 0;
129 return SelCount / 3 + i;
130 };
131
132 int TProtocolTopographyManagePrintDlg::GetColumn( void )
133 {
134 return 4;
135 };
136
137 LPSTR TProtocolTopographyManagePrintDlg::GetSelLfdNr(LPSTR lLfdNr, int Index )
138 {
139 char buf[MaxString];
140
141 ListView_GetItemText(hSuchList,Index,0,buf,MaxString);
142 strcpy(lLfdNr, buf);
143 ListView_GetItemText(hSuchList,Index,2,buf,MaxString);
144 strcat(lLfdNr, buf);
145 return lLfdNr;
146 };
147
148 BOOL TProtocolTopographyManagePrintDlg::PrintSkizze(int i)
149 {
150 if (i == Winkel)
151 return TRUE;
152 return FALSE;
153 };
154
155 BOOL TProtocolTopographyManagePrintDlg::PrintLine(int i)
156 {
157 if ( (i == RTKNr) || (i == Nutzer) || (i == Material) || (i == Beugungswinkel) ||
158 (i == KKruemmung) || (i == ImpMax) || (i == FAbstand) || (i == EXPT) ||
159 (i == DFnach) || (i == HWB) )
160 return TRUE;
161 return FALSE;
162 };
163
164 void TProtocolTopographyManagePrintDlg::GetParameterName(int& i, LPSTR Parameter)
165 {
166 ProtocolTopography->GetParameterNamen(i, Parameter);
167 strcat(Parameter, ":");
168 };
169
170 BOOL TProtocolTopographyManagePrintDlg::GetParameter(int& i, LPSTR Parameter, LPCSTR lLfdNr)
171 {
172 char ParameterValue[MaxParameterString];
173
174 if ( strcmp(ProtocolTopography->GetLfdNr(ParameterValue), lLfdNr) != 0)
175 if ( ProtocolTopography->LoadProtocolString(lLfdNr) != 0 )
176 return FALSE;
177
178 ProtocolTopography->GetProtocolValue( i, Parameter);
179 if (strlen(Parameter) == 0)
180 strcpy(Parameter, "-");
181
182 if ( (i == GroesseX) || (i == PGroesseX) )
183 {
184 ProtocolTopography->GetProtocolValue( ++i, ParameterValue );
185 if (strlen(ParameterValue) != 0)
186 {
187 strcat(Parameter, " x ");
188 strcat(Parameter, ParameterValue);
189 }
190 }
191 return TRUE;
192 };
193
194
195 // LastLine
196
197
198