Commit | Autor | Alter
|
8c7455
|
1 |
// FilterDlg.cpp |
JS |
2 |
|
|
3 |
#include <gtk/gtk.h> |
|
4 |
#include "FilterDlg.h" |
|
5 |
#include <stdlib.h> |
|
6 |
#include <string.h> |
|
7 |
|
|
8 |
|
|
9 |
FilterDlg::FilterDlg(float* pos,float* ori){ |
|
10 |
|
|
11 |
GtkWidget* hbox[2],*frame[2],*vbox; |
|
12 |
char tmp[20]; |
|
13 |
|
|
14 |
m_dlg=gtk_dialog_new_with_buttons("Set Filter Values",NULL,GTK_DIALOG_MODAL,GTK_STOCK_OK, |
|
15 |
GTK_RESPONSE_OK,GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,NULL); |
|
16 |
gtk_container_set_border_width(GTK_CONTAINER(m_dlg),30); |
|
17 |
hbox[0]=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5); |
|
18 |
hbox[1]=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5); |
|
19 |
|
|
20 |
frame[0]=gtk_frame_new("Position"); |
|
21 |
frame[1]=gtk_frame_new("Orientation"); |
|
22 |
|
|
23 |
vbox=gtk_box_new(GTK_ORIENTATION_VERTICAL,10); |
|
24 |
|
|
25 |
|
|
26 |
for (int a=0;a<2;a++){ |
|
27 |
|
|
28 |
for (int i=0;i<4;i++){ |
|
29 |
m_entry[a][i]=gtk_entry_new(); |
|
30 |
gtk_widget_set_size_request(m_entry[a][i],75,25); |
|
31 |
gtk_box_pack_start(GTK_BOX(hbox[a]),m_entry[a][i],TRUE,TRUE,10); |
|
32 |
} |
|
33 |
|
|
34 |
|
|
35 |
gtk_container_add(GTK_CONTAINER(frame[a]),hbox[a]); |
|
36 |
|
|
37 |
|
|
38 |
gtk_box_pack_start(GTK_BOX(vbox),frame[a],FALSE,FALSE,5); |
|
39 |
|
|
40 |
} |
|
41 |
|
|
42 |
gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(m_dlg))),vbox); |
|
43 |
|
|
44 |
for (int i=0;i<4;i++){ |
|
45 |
sprintf(tmp,"%.4f",pos[i]); |
|
46 |
gtk_entry_set_text(GTK_ENTRY(m_entry[0][i]),tmp); |
|
47 |
sprintf(tmp,"%.4f",ori[i]); |
|
48 |
gtk_entry_set_text(GTK_ENTRY(m_entry[1][i]),tmp); |
|
49 |
} |
|
50 |
|
|
51 |
gtk_widget_show_all(m_dlg); |
|
52 |
}; |
|
53 |
|
|
54 |
|
|
55 |
void FilterDlg::update_data(){ |
|
56 |
|
|
57 |
const gchar* tmp; |
|
58 |
for (int i=0;i<4;i++){ |
|
59 |
tmp=gtk_entry_get_text(GTK_ENTRY(m_entry[0][i])); |
|
60 |
m_posFiltVals[i]=atof(tmp); |
|
61 |
tmp=gtk_entry_get_text(GTK_ENTRY(m_entry[1][i])); |
|
62 |
m_oriFiltVals[i]=atof(tmp); |
|
63 |
} |
|
64 |
} |
|
65 |
|
|
66 |
void FilterDlg::GetFilterData(float* posVals,float* oriVals){ |
|
67 |
|
|
68 |
const int FLOAT4=sizeof(float)*4; |
|
69 |
memcpy(posVals,m_posFiltVals,FLOAT4); |
|
70 |
memcpy(oriVals,m_oriFiltVals,FLOAT4); |
|
71 |
} |
|
72 |
|