~ubuntu-branches/ubuntu/intrepid/glbsp/intrepid

« back to all changes in this revision

Viewing changes to nodeview/window.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
//  WINDOW : Main application window
 
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
#ifndef WIN32
 
23
#include <unistd.h>
 
24
#endif
 
25
 
 
26
 
 
27
Guix_MainWin *guix_win;
 
28
 
 
29
 
 
30
#define WINDOW_MIN_W  480
 
31
#define WINDOW_MIN_H  440
 
32
 
 
33
#define WINDOW_NORM_W  620
 
34
#define WINDOW_NORM_H  460
 
35
 
 
36
 
 
37
static void main_win_close_CB(Fl_Widget *w, void *data)
 
38
{
 
39
  if (guix_win)
 
40
    guix_win->want_quit = true;
 
41
}
 
42
 
 
43
 
 
44
//
 
45
// WindowSmallDelay
 
46
//
 
47
// This routine is meant to delay a short time (e.g. 1/5th of a
 
48
// second) to allow the window manager to move our windows around.
 
49
//
 
50
// Hopefully such nonsense doesn't happen under Win32.
 
51
//
 
52
void WindowSmallDelay(void)
 
53
{
 
54
#ifndef WIN32
 
55
  Fl::wait(0);  usleep(100 * 1000);
 
56
  Fl::wait(0);  usleep(100 * 1000);
 
57
#endif
 
58
 
 
59
  Fl::wait(0);
 
60
}
 
61
 
 
62
 
 
63
//
 
64
// MainWin Constructor
 
65
//
 
66
Guix_MainWin::Guix_MainWin(const char *title) :
 
67
     Fl_Double_Window(WINDOW_NORM_W, WINDOW_NORM_H, title)
 
68
{
 
69
  // turn off auto-add-widget mode
 
70
  end();
 
71
 
 
72
  size_range(WINDOW_MIN_W, WINDOW_MIN_H);
 
73
 
 
74
  // Set initial position.
 
75
  //
 
76
  // Note: this may not work properly.  It seems that when my window
 
77
  // manager adds the titlebar/border, it moves the actual window
 
78
  // down and slightly to the right, causing subsequent invokations
 
79
  // to keep going lower and lower.
 
80
 
 
81
  ///  position(guix_prefs.win_x, guix_prefs.win_y);
 
82
 
 
83
  callback((Fl_Callback *) main_win_close_CB);
 
84
 
 
85
  // set a nice darkish gray for the space between main boxes
 
86
  color(MAIN_BG_COLOR, MAIN_BG_COLOR);
 
87
 
 
88
  want_quit = false;
 
89
 
 
90
 
 
91
  // create contents
 
92
  int hw = (w() - 8*2 - 4) / 2;
 
93
  int mh = 28;
 
94
 
 
95
#ifdef MACOSX
 
96
  mh = 1;
 
97
#endif
 
98
 
 
99
  menu_bar = MenuCreate(0, 0, w()-200, 28);
 
100
  add(menu_bar);
 
101
 
 
102
  grid = new W_Grid(0, mh, w()-200, h()-mh);
 
103
  add(grid);
 
104
  resizable(grid);
 
105
 
 
106
  info = new W_Info(w()-200, mh*0, 200, h()-mh*0);
 
107
  add(info);
 
108
 
 
109
#if 0
 
110
  build_mode = new Guix_BuildMode(8, 4+mh, hw, 176);
 
111
  add(build_mode);
 
112
 
 
113
  misc_opts  = new Guix_MiscOptions(8+hw+4, 4+mh, hw, 136);
 
114
  add(misc_opts);
 
115
 
 
116
  factor = new Guix_FactorBox(8+hw+4, 140+mh, hw, 40);
 
117
  add(factor);
 
118
 
 
119
  files = new Guix_FileBox(8, 184+mh, w()-8*2, 86);
 
120
  add(files);
 
121
 
 
122
  builder = new Guix_BuildButton(8, 274+10+mh, hw, 60);
 
123
  add(builder);
 
124
 
 
125
  progress = new Guix_ProgressBox(8+hw+4, 274+mh, hw, 74);
 
126
  add(progress);
 
127
 
 
128
  text_box = new Guix_TextBox(0, 352+mh, w(), h() - 352 - mh);
 
129
  add(text_box);
 
130
  resizable(text_box);
 
131
#endif
 
132
 
 
133
  // show window (pass some dummy arguments)
 
134
  int argc = 1;
 
135
  char *argv[] = { "nodeview", NULL };
 
136
 
 
137
  show(argc, argv);
 
138
 
 
139
  // read initial pos, giving 1/5th of a second for the WM to adjust
 
140
  // our window's position (naughty WM...)
 
141
  WindowSmallDelay();
 
142
 
 
143
  init_x = x(); init_y = y();
 
144
  init_w = w(); init_h = h();
 
145
}
 
146
 
 
147
//
 
148
// MainWin Destructor
 
149
//
 
150
Guix_MainWin::~Guix_MainWin()
 
151
{
 
152
  WritePrefs();
 
153
}
 
154
 
 
155
 
 
156
void Guix_MainWin::WritePrefs()
 
157
{
 
158
  // check if moved or resized
 
159
  if (x() != init_x || y() != init_y)
 
160
  {
 
161
    ///    guix_prefs.win_x = x();
 
162
    ///    guix_prefs.win_y = y();
 
163
  }
 
164
 
 
165
  if (w() != init_w || h() != init_h)
 
166
  {
 
167
    ///    guix_prefs.win_w = w();
 
168
    ///    guix_prefs.win_h = h();
 
169
  }
 
170
}
 
171