~ubuntu-branches/ubuntu/natty/glbsp/natty

« back to all changes in this revision

Viewing changes to nodeview/menu.cc

  • Committer: Bazaar Package Importer
  • Author(s): Darren Salt
  • Date: 2008-01-30 13:33:49 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080130133349-kgojg33vyiu8xbvp
Tags: 2.24-1
* New upstream release.
* Bumped the lib soname and the library package name due to one silly
  little binary incompatibility caused by changes in an exported struct.
  (Safe; nothing else currently in the archive has ever used libglbsp2.)
* Removed my patches since they're all applied upstream.
* Updated the list of documentation files.
* Build-time changes:
  - Switched from dh_movefiles to dh_install.
  - Updated my makefile to cope with upstream changes.
  - Corrected for debian-rules-ignores-make-clean-error.
  - Corrected for substvar-source-version-is-deprecated.
  - Link libglbsp, rather than glbsp, with libm and libz.
* Fixed shlibdeps. (Closes: #460387)
* Bumped standards version to 3.7.3 (no other changes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//------------------------------------------------------------------------
 
2
//  MENU : Menu handling
 
3
//------------------------------------------------------------------------
 
4
//
 
5
//  GL-Node Viewer (C) 2004-2007 Andrew Apted
 
6
//
 
7
//  This program is free software; you can redistribute it and/or
 
8
//  modify it under the terms of the GNU General Public License
 
9
//  as published by the Free Software Foundation; either version 2
 
10
//  of the License, or (at your option) any later version.
 
11
//
 
12
//  This program is distributed in the hope that it will be useful,
 
13
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
//  GNU General Public License for more details.
 
16
//
 
17
//------------------------------------------------------------------------
 
18
 
 
19
// this includes everything we need
 
20
#include "defs.h"
 
21
 
 
22
 
 
23
static bool menu_want_to_quit;
 
24
 
 
25
 
 
26
#if 0
 
27
static void menu_quit_CB(Fl_Widget *w, void *data)
 
28
{
 
29
  menu_want_to_quit = true;
 
30
}
 
31
#endif
 
32
 
 
33
 
 
34
#ifndef MACOSX
 
35
static void menu_do_exit(Fl_Widget *w, void * data)
 
36
{
 
37
  guix_win->want_quit = true;
 
38
}
 
39
#endif
 
40
 
 
41
 
 
42
//------------------------------------------------------------------------
 
43
 
 
44
static void menu_do_prefs(Fl_Widget *w, void * data)
 
45
{
 
46
}
 
47
 
 
48
 
 
49
//------------------------------------------------------------------------
 
50
 
 
51
static const char *about_Info =
 
52
  "By Andrew Apted (C) 2004-2007";
 
53
 
 
54
 
 
55
static void menu_do_about(Fl_Widget *w, void * data)
 
56
{
 
57
#if 0
 
58
  menu_want_to_quit = false;
 
59
 
 
60
  Fl_Window *ab_win = new Fl_Window(600, 340, "About " PROG_NAME);
 
61
  ab_win->end();
 
62
 
 
63
  // non-resizable
 
64
  ab_win->size_range(ab_win->w(), ab_win->h(), ab_win->w(), ab_win->h());
 
65
  ab_win->position(guix_prefs.manual_x, guix_prefs.manual_y);
 
66
  ab_win->callback((Fl_Callback *) menu_quit_CB);
 
67
 
 
68
  // add the about image
 
69
  Fl_Group *group = new Fl_Group(0, 0, 230, ab_win->h());
 
70
  group->box(FL_FLAT_BOX);
 
71
  group->color(FL_BLACK, FL_BLACK);
 
72
  ab_win->add(group);
 
73
  
 
74
  Fl_Box *box = new Fl_Box(20, 90, ABOUT_IMG_W+2, ABOUT_IMG_H+2);
 
75
  box->image(about_image);
 
76
  group->add(box); 
 
77
 
 
78
 
 
79
  // nice big logo text
 
80
  box = new Fl_Box(240, 5, 350, 50, "glBSPX  " GLBSP_VER);
 
81
  box->labelsize(24);
 
82
  ab_win->add(box);
 
83
 
 
84
  // about text
 
85
  box = new Fl_Box(240, 60, 350, 270, about_Info);
 
86
  box->align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT | FL_ALIGN_TOP);
 
87
  ab_win->add(box);
 
88
   
 
89
 
 
90
  // finally add an "OK" button
 
91
  Fl_Button *button = new Fl_Button(ab_win->w()-10-60, ab_win->h()-10-30, 
 
92
      60, 30, "OK");
 
93
  button->callback((Fl_Callback *) menu_quit_CB);
 
94
  ab_win->add(button);
 
95
    
 
96
  ab_win->set_modal();
 
97
  ab_win->show();
 
98
  
 
99
  // capture initial size
 
100
  WindowSmallDelay();
 
101
  int init_x = ab_win->x();
 
102
  int init_y = ab_win->y();
 
103
  
 
104
  // run the GUI until the user closes
 
105
  while (! menu_want_to_quit)
 
106
    Fl::wait();
 
107
 
 
108
  // check if the user moved/resized the window
 
109
  if (ab_win->x() != init_x || ab_win->y() != init_y)
 
110
  {
 
111
    guix_prefs.manual_x = ab_win->x();
 
112
    guix_prefs.manual_y = ab_win->y();
 
113
  }
 
114
 
 
115
  // this deletes all the child widgets too...
 
116
  delete ab_win;
 
117
#endif
 
118
}
 
119
 
 
120
 
 
121
//------------------------------------------------------------------------
 
122
 
 
123
static void menu_do_manual(Fl_Widget *w, void * data)
 
124
{
 
125
}
 
126
 
 
127
 
 
128
//------------------------------------------------------------------------
 
129
 
 
130
static void menu_do_license(Fl_Widget *w, void * data)
 
131
{
 
132
}
 
133
 
 
134
 
 
135
//------------------------------------------------------------------------
 
136
 
 
137
static void menu_do_save_log(Fl_Widget *w, void * data)
 
138
{
 
139
}
 
140
 
 
141
 
 
142
//------------------------------------------------------------------------
 
143
 
 
144
#undef FCAL
 
145
#define FCAL  (Fl_Callback *)
 
146
 
 
147
static Fl_Menu_Item menu_items[] = 
 
148
{
 
149
    { "&File", 0, 0, 0, FL_SUBMENU },
 
150
        { "&Preferences...",    0, FCAL menu_do_prefs },
 
151
        { "&Save Log...",       0, FCAL menu_do_save_log },
 
152
#ifndef MACOSX
 
153
        { "E&xit",   FL_ALT + 'q', FCAL menu_do_exit },
 
154
#endif
 
155
        { 0 },
 
156
 
 
157
    { "&Help", 0, 0, 0, FL_SUBMENU },
 
158
        { "&About...",         0,  FCAL menu_do_about },
 
159
        { "&License...",       0,  FCAL menu_do_license },
 
160
        { "&Manual...",   FL_F+1,  FCAL menu_do_manual },
 
161
        { 0 },
 
162
 
 
163
    { 0 }
 
164
};
 
165
 
 
166
 
 
167
//
 
168
// MenuCreate
 
169
//
 
170
#ifdef MACOSX
 
171
Fl_Sys_Menu_Bar * MenuCreate(int x, int y, int w, int h)
 
172
{
 
173
  Fl_Sys_Menu_Bar *bar = new Fl_Sys_Menu_Bar(x, y, w, h);
 
174
  bar->menu(menu_items);
 
175
  return bar;
 
176
}
 
177
#else
 
178
Fl_Menu_Bar * MenuCreate(int x, int y, int w, int h)
 
179
{
 
180
  Fl_Menu_Bar *bar = new Fl_Menu_Bar(x, y, w, h);
 
181
  bar->menu(menu_items);
 
182
  return bar;
 
183
}
 
184
#endif
 
185