commit | author | age
|
69b66f
|
1 |
// IncrDlg.cpp |
JS |
2 |
|
|
3 |
#include <gtk/gtk.h> |
|
4 |
#include "IncrDlg.h" |
|
5 |
#include <glib/gprintf.h> |
|
6 |
#include <stdlib.h> |
|
7 |
|
|
8 |
IncrDlg::IncrDlg(float nPos,float nOri){ |
|
9 |
|
|
10 |
m_posIncr=nPos; |
|
11 |
m_oriIncr=nOri; |
|
12 |
gchar str[100]; |
|
13 |
|
|
14 |
m_dlg=gtk_dialog_new_with_buttons("Specify Increments",NULL,GTK_DIALOG_MODAL,GTK_STOCK_OK, |
|
15 |
GTK_RESPONSE_OK,GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,NULL); |
|
16 |
|
|
17 |
GtkWidget* table=gtk_table_new(4,2,TRUE); |
|
18 |
GtkWidget *lab1,*lab2; |
|
19 |
|
|
20 |
lab1=gtk_label_new("Position Increment"); |
|
21 |
lab2=gtk_label_new("Orientation Increment"); |
|
22 |
m_entry_p=gtk_entry_new(); |
|
23 |
m_entry_o=gtk_entry_new(); |
|
24 |
|
|
25 |
gtk_table_attach_defaults(GTK_TABLE(table),lab1,0,1,1,2); |
|
26 |
gtk_table_attach_defaults(GTK_TABLE(table),lab2,0,1,3,4); |
|
27 |
gtk_table_attach(GTK_TABLE(table),m_entry_p,1,2,1,2, |
|
28 |
(GtkAttachOptions)(GTK_EXPAND|GTK_FILL), |
|
29 |
(GtkAttachOptions)(GTK_EXPAND|GTK_FILL),5,0); |
|
30 |
gtk_table_attach(GTK_TABLE(table),m_entry_o,1,2,3,4, |
|
31 |
(GtkAttachOptions)(GTK_FILL|GTK_EXPAND), |
|
32 |
(GtkAttachOptions)(GTK_FILL|GTK_EXPAND),5,0); |
|
33 |
|
|
34 |
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(m_dlg)->vbox),table,TRUE,TRUE,10); |
|
35 |
|
|
36 |
g_sprintf(str,"%.3f",m_posIncr); |
|
37 |
gtk_entry_set_text(GTK_ENTRY(m_entry_p),str); |
|
38 |
g_sprintf(str,"%.3f",m_oriIncr); |
|
39 |
gtk_entry_set_text(GTK_ENTRY(m_entry_o),str); |
|
40 |
|
|
41 |
gtk_widget_show_all(m_dlg); |
|
42 |
|
|
43 |
} |
|
44 |
|
|
45 |
void IncrDlg::update_data(){ |
|
46 |
|
|
47 |
const gchar* str=gtk_entry_get_text(GTK_ENTRY(m_entry_p)); |
|
48 |
m_posIncr=atof(str); |
|
49 |
|
|
50 |
|
|
51 |
str=gtk_entry_get_text(GTK_ENTRY(m_entry_o)); |
|
52 |
m_oriIncr=atof(str); |
|
53 |
|
|
54 |
} |
|
55 |
|
|
56 |
void IncrDlg::get_increments(float& nPos,float& nOri){ |
|
57 |
|
|
58 |
nPos=m_posIncr; |
|
59 |
nOri=m_oriIncr; |
|
60 |
} |