~ubuntu-branches/ubuntu/vivid/imaze/vivid

« back to all changes in this revision

Viewing changes to source/xv_tasten.c

  • Committer: Bazaar Package Importer
  • Author(s): Hans Freitag
  • Date: 2002-11-28 13:24:12 UTC
  • Revision ID: james.westby@ubuntu.com-20021128132412-lw82xl9oq1j36g8b
Tags: upstream-1.4
ImportĀ upstreamĀ versionĀ 1.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
** - - -  iMaze  - - -
 
3
**
 
4
** Copyright (c) 1993-2001 by Hans-Ulrich Kiel & Joerg Czeranski
 
5
** All rights reserved.
 
6
**
 
7
** Redistribution and use in source and binary forms, with or without
 
8
** modification, are permitted provided that the following conditions are
 
9
** met:
 
10
**
 
11
** 1. Redistributions of source code must retain the above copyright
 
12
**    notice, this list of conditions and the following disclaimer.
 
13
** 2. Redistributions in binary form must reproduce the above copyright
 
14
**    notice, this list of conditions and the following disclaimer in the
 
15
**    documentation and/or other materials provided with the distribution.
 
16
** 3. The name of the authors may not be used to endorse or promote
 
17
**    products derived from this software without specific prior written
 
18
**    permission.
 
19
** 4. The name ``iMaze'' may not be used for products derived from this
 
20
**    software unless a prefix or a suffix is added to the name.
 
21
**
 
22
** THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
 
23
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 
24
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 
25
** DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT,
 
26
** INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 
27
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 
28
** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 
29
** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 
30
** STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 
31
** IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
32
** POSSIBILITY OF SUCH DAMAGE.
 
33
**
 
34
**
 
35
** Datei: xv_tasten.c
 
36
**
 
37
** Kommentar:
 
38
**  Wertet Events von der Tastatur aus und setzt definierte Signale
 
39
*/
 
40
 
 
41
 
 
42
#include <xview/xview.h>
 
43
#include <xview/canvas.h>
 
44
#include <xview/panel.h>
 
45
 
 
46
#include "argv.h"
 
47
#include "global.h"
 
48
#include "signale.h"
 
49
#include "ereignisse.h"
 
50
#include "einaus.h"
 
51
#include "grafik.h"
 
52
#include "xv_einaus.h"
 
53
#include "X_tasten.h"
 
54
 
 
55
static char sccsid[] = "@(#)xv_tasten.c 3.6 12/3/01";
 
56
 
 
57
 
 
58
struct arg_option xv_eingabe_opts[] =
 
59
{
 
60
        { Arg_Include, NULL, X_eingabe_opts },
 
61
        { Arg_End }
 
62
};
 
63
 
 
64
 
 
65
/*
 
66
** event_routine
 
67
**  verarbeitet die Tastatur-Events und ordnet sie den internen Signalen zu
 
68
**
 
69
** Parameter:
 
70
**  window: Fenster fuer den der Event bestimmt ist
 
71
**  event: Beschreibung des Events
 
72
**
 
73
** Seiteneffekte:
 
74
**  aktiv wird veraendert
 
75
*/
 
76
static void event_routine(Xv_Window window, Event *event)
 
77
{
 
78
        X_event_routine(XV_DISPLAY_FROM_WINDOW(event_window(event)),
 
79
                event_xevent(event));
 
80
}
 
81
 
 
82
 
 
83
/*
 
84
** frame_init
 
85
**  sucht in einem Fenster nach Unterfenstern vom Typ CANVAS und
 
86
**  initialisiert darin die Event-Abfrage
 
87
**
 
88
** Parameter:
 
89
**  frame: Fenster, in dem gesucht werden soll
 
90
*/
 
91
static void frame_init(Frame frame)
 
92
{
 
93
        int i;
 
94
        Window subwindow;
 
95
 
 
96
        for (i = 1; (subwindow = xv_get(frame,
 
97
                FRAME_NTH_SUBWINDOW, i)) != 0; i++)
 
98
                if ((Xv_pkg *)xv_get(subwindow, XV_TYPE) == CANVAS)
 
99
                {
 
100
                        /* KBD_DONE: Fenster verliert Fokus
 
101
                           WIN_ASCII_EVENT: Tasten werden gedrueckt
 
102
                           WIN_UP_EVENT: Taste losgelassen (wird evtl.
 
103
                           nicht unterstuetzt) */
 
104
                        xv_set(canvas_paint_window(subwindow),
 
105
                                WIN_CONSUME_EVENTS,
 
106
                                        KBD_DONE, WIN_ASCII_EVENTS,
 
107
                                        WIN_UP_EVENTS, 0,
 
108
                                WIN_EVENT_PROC, event_routine,
 
109
                                0);
 
110
                }
 
111
}
 
112
 
 
113
 
 
114
/* bis hier lokaler Teil                       */
 
115
/***********************************************/
 
116
/* ab hier globaler Teil                       */
 
117
 
 
118
 
 
119
/*
 
120
** xv_eingabe_init
 
121
**  sucht nach Unterfenstern vom Typ CANVAS und initialisiert darin
 
122
**  die Event-Abfrage
 
123
**
 
124
** Parameter:
 
125
**  hauptframe: Fenster, von dem alle anderen Fenster abstammen
 
126
**  panel: Panel, in dem Buttons ergaenzt werden duerfen
 
127
**
 
128
** Rueckgabewert:
 
129
**  0 fuer Erfolg, 1 fuer Fehler
 
130
*/
 
131
int xv_eingabe_init(Frame hauptframe, Panel panel)
 
132
{
 
133
        int i;          /* Index */
 
134
        Frame subframe; /* ein Fenster */
 
135
 
 
136
        /* im Hauptfenster suchen */
 
137
        frame_init(hauptframe);
 
138
 
 
139
        /* in allen weiteren Fenstern suchen */
 
140
        for (i = 1; (subframe = xv_get(hauptframe,
 
141
                FRAME_NTH_SUBFRAME, i)) != 0; i++)
 
142
                frame_init(subframe);
 
143
 
 
144
        return X_eingabe_init();
 
145
}
 
146
 
 
147
 
 
148
/*
 
149
** xv_eingabe_ende
 
150
**  Dummy-Routine fuer das Schliessen von Eingabekanaelen etc.
 
151
*/
 
152
void xv_eingabe_ende(void)
 
153
{
 
154
        X_eingabe_ende();
 
155
}