summaryrefslogtreecommitdiff
path: root/gtk2_ardour/ardour_dialog.cc
blob: 030be0486e4bf3e11a66a0c9917e1dca55cffc29 (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
119
120
121
122
123
124
125
126
127
/*
    Copyright (C) 2002 Paul Davis

    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., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

#include <iostream>

#include <gtkmm2ext/doi.h>

#include "ardour_dialog.h"
#include "keyboard.h"
#include "ardour_ui.h"


ArdourDialog::ArdourDialog (string name)
	: Dialog (name)
{
	session = 0;
	kbd_input = false;
	running = false;
	_run_status = 0;
	_within_hiding = false;
	hide_on_stop = true;
}

ArdourDialog::~ArdourDialog ()
{
}

bool
ArdourDialog::on_enter_notify_event (GdkEventCrossing *ev)
{
	if (ev->detail != GDK_NOTIFY_INFERIOR) {
		// GTK2FIX
		//Keyboard::the_keyboard().set_current_dialog (this);
	}
	return false;
}

bool
ArdourDialog::on_leave_notify_event (GdkEventCrossing *ev)
{
	if (ev->detail != GDK_NOTIFY_INFERIOR) {
		// GTK2FIX
		//Keyboard::the_keyboard().set_current_dialog (0);
	}
	return false;
}

void
ArdourDialog::on_unmap ()
{
	_within_hiding = true;
	_within_hiding = false;
	Dialog::on_unmap ();
}

void
ArdourDialog::set_hide_on_stop (bool yn)
{
	hide_on_stop = yn;
}

void
ArdourDialog::stop (int rr)
{
	if (hide_on_stop) {
		hide_all ();
	}

	if (running) {
		if (rr == 0) {
			response (GTK_RESPONSE_ACCEPT);
		} else {
			response (GTK_RESPONSE_CANCEL);
		}
		running = false;
	}
}

void
ArdourDialog::run ()
{
	show_all ();

	running = true;
	switch (Dialog::run ()) {
	case GTK_RESPONSE_ACCEPT:
		_run_status = 0;
		break;
		
	case GTK_RESPONSE_DELETE_EVENT:
		_run_status = -1;
		break;

	default:
		_run_status = -1;
	}

	hide_all ();
}

void
ArdourDialog::set_keyboard_input (bool yn)
{
	kbd_input = yn;
}

int
ArdourDialog::run_status ()
{
	return _run_status;
}