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