~ubuntu-branches/ubuntu/quantal/texmacs/quantal

« back to all changes in this revision

Viewing changes to src/Plugins/Widkit/Basic/basic_widget.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Atsuhito KOHDA, Kamaraju Kusumanchi, kohda
  • Date: 2009-04-26 19:35:14 UTC
  • mfrom: (1.1.10 upstream) (4.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090426193514-9yo3oggdslgdls4b
Tags: 1:1.0.7.2-1
[Kamaraju Kusumanchi <kamaraju@gmail.com>]
* New upstream release
* texmacs crashes if /usr/share/texmacs/TeXmacs/misc/pixmaps/unknown.ps
  is not present. Do not remove it. (Closes: #484073, #497021)
* update patches 03_mupad.dpatch, 04_axiom.dpatch, 11-desktop-file.dpatch
* fix the mime problem in gnome. Thanks to Andrea Gamba for the fix.
[kohda]
* Refined a fix for the mime problem in gnome a bit.
* Try to fix /bin/sh problem (debian/fixsh) but it is not complete fix yet.
* Try to fix hard coded settings for ipa fonts(patches/09_ipa.dpatch), 
  especially for Debian where no ipa fonts exist yet.
* Fixed obsolete Build-Depends: changed libltdl3-dev to 
  libltdl-dev | libltdl7-dev (the latter for Ubuntu?)

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
* DESCRIPTION: Basic widgets can handle the most common events
5
5
* COPYRIGHT  : (C) 1999  Joris van der Hoeven
6
6
*******************************************************************************
7
 
* This software falls under the GNU general public license and comes WITHOUT
8
 
* ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details.
9
 
* If you don't have this file, write to the Free Software Foundation, Inc.,
10
 
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
7
* This software falls under the GNU general public license version 3 or later.
 
8
* It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
 
9
* in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
11
10
******************************************************************************/
12
11
 
13
12
#include "Widkit/basic_widget.hpp"
103
102
      ev->w= a[i];
104
103
      return;
105
104
    }
106
 
  fatal_error ("Could not get widget attribute " * ev->which);
 
105
  WK_FAILED ("could not get widget attribute " * ev->which);
107
106
}
108
107
 
109
108
void
111
110
  int i;
112
111
  for (i=0; i<N(a); i++)
113
112
    if (name[i] == ev->which) { a[i]= ev->w; return; }
114
 
  fatal_error ("Could not set widget attribute " * ev->which);
 
113
  WK_FAILED ("could not set widget attribute " * ev->which);
115
114
}
116
115
 
117
116
/******************************************************************************
121
120
void
122
121
basic_widget_rep::handle_attach_window (attach_window_event ev) {
123
122
  if ((win!=NULL) && (ev->win!=NULL) && (win!=ev->win))
124
 
    fatal_error ("Widget already attached to another window",
125
 
                 "basic_widget_rep::handle_attach_window");
126
 
  else win= ev->win;
127
 
  int i;
128
 
  for (i=0; i<N(a); i++) a[i] << emit_attach_window (win);
 
123
    WK_FAILED ("widget already attached to another window");
 
124
  win= ev->win;
 
125
  for (int i=0; i<N(a); i++) a[i] << emit_attach_window (win);
129
126
}
130
127
 
131
128
void
184
181
 
185
182
void
186
183
basic_widget_rep::handle_clear (clear_event ev) {
187
 
  win->set_background (white);
188
 
  win->clear (ev->x1, ev->y1, ev->x2, ev->y2);
 
184
  renderer ren= win->get_renderer ();
 
185
  ren->set_background (white);
 
186
  ren->clear (ev->x1, ev->y1, ev->x2, ev->y2);
189
187
}
190
188
 
191
189
void
234
232
 
235
233
void
236
234
test_round (wk_widget w, string var, SI num) {
237
 
  if (num != ((num>>8)<<8))
238
 
    w->fatal_error ("Bad rounding of " * var * "=" * as_string (num),
239
 
                    "test_round", "basic_widget.cpp");
 
235
  if (num != ((num>>8)<<8)) {
 
236
    w->wk_error ("Bad rounding of " * var * "=" * as_string (num));
 
237
    FAILED ("bad rounding");
 
238
  }
240
239
}
241
240
 
242
241
static void
245
244
    cerr << "\n" << HRULE << "\n";
246
245
    cerr << ev << " was sent to\n" << w;
247
246
    cerr << HRULE << "\n";
248
 
    fatal_error ("widget was not yet attached to window",
249
 
                 "basic_widget::handle", "basic_widget.cpp");
 
247
    FAILED ("widget was not yet attached to window");
250
248
  }
251
249
}
252
250
 
254
252
basic_widget_rep::handle (event ev) {
255
253
  if (DEBUG_EVENTS) cout << "TeXmacs] " << ev << "\n";
256
254
  // " ---> " << wk_widget (this) << "\n";
257
 
  if (attached ()) win->set_origin (ox, oy);
 
255
  if (attached ()) win->get_renderer ()->set_origin (ox, oy);
258
256
  switch (ev->type) {
259
257
  case GET_SIZE_EVENT:
260
258
    handle_get_size (ev);
320
318
    SI ry2= min (e->y2, y2())- oy;
321
319
    if ((rx2 > rx1) && (ry2 > ry1)) {
322
320
      event ev= ::emit_clear (rx1, ry1, rx2, ry2);
323
 
      win->clip (rx1, ry1, rx2, ry2);
 
321
      win->get_renderer ()->clip (rx1, ry1, rx2, ry2);
324
322
      handle_clear (ev);
325
 
      win->unclip ();
 
323
      win->get_renderer ()->unclip ();
326
324
    }
327
325
    return true;
328
326
  }
336
334
 
337
335
    if ((rx2 > rx1) && (ry2 > ry1)) {
338
336
      event ev= ::emit_repaint (rx1, ry1, rx2, ry2, e->stop);
339
 
      win->clip (rx1, ry1, rx2, ry2);
 
337
      win->get_renderer ()->clip (rx1, ry1, rx2, ry2);
340
338
      handle_repaint (ev);
341
 
      win->unclip ();
 
339
      win->get_renderer ()->unclip ();
342
340
    }
343
341
 
344
342
    int i;