summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/ovision/ui/ui.hh
blob: 049ac6df226764a6c7f7a6d6403c17f6be5aa135 (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// robert - programme du robot 2005 
// 
// Copyright (C) 2005 Olivier Gaillard
//
// Robot APB Team/Efrei 2005.
//        Web: http://assos.efrei.fr/robot/
//      Email: robot AT efrei DOT fr
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

#ifndef UI_h
#define UI_h

// Realis� a l'aide du "NCURSES Programming HOWTO"


#include <menu.h>
#include "ovision/see/oconfig.hh"
#include "ovision/see/group.hh"


#define NUM_COULEUR 1
#define NB_COULEUR  2


/// Interface ncurses permettant de piloter adjust
class UI {

    /// Variable utilisees pour ncurses
    ITEM **item;
    MENU *mainMenu;
    WINDOW *mainWindow;

    /// Id du fifo
    int fifo; 
    
    /// PID du prog
    long pid; 

    /// Sauvegarde la valeur de sorties du NN
    int savedNNColorNumber; 

    /// liste des images
    char **fileList; 
    
    /// id de l'image actuel
    int curImage; 

    /// taille de la liste
    int lengthFileList;

    OConfig *oconfig;

	
  public:
	/// Constructeurs.
	UI (const char *filename = "");

	/// Destructeur.
	~UI (void);
	
	/// Affiche le menu principale
	void menu (); 
    
	/// reponse du programme adjust
	int uiReady;
	
  protected:
	/// Cree la liste d'images a ouvrir
	void parseFileList(); 

	/// Menu de selection de couleur
	int chooseColor (const int type, const int current = 0);
	
	/// Affiche un msg dans la barre d'etat
	void printStatus (const char *str); 

	/// Menu de suppression de couleur
	void goDelColor (); 

	/// menu de selection d'objet
	int chooseObject (const int current);

	/// Menu de selection du group a former
	void goSelectGroup (const int type); 

	/// Menu de melange de couleurs
	void goMergeWindow (); 

	/// Menu de changements des composantes d'un poid du NN
	void goChangeColor ();

	/// Synchronisation des poids locaux et de ceux du programme adjust
	void updateNodes ();
	
	/// Envoie une donnee au prog adjust
	void sendSignal (const char *buf); 

	// Affiche les objets et poteaux trouv�s
	void showObjectsFound ();

	void newNN (const int nbColor);
};


#endif // UI_h