]> git.lyx.org Git - lyx.git/blob - src/frontends/kde/formcitationdialog.C
Angus's FormInset work; Dekel's languages patch; my reworking of Angus's stuff +...
[lyx.git] / src / frontends / kde / formcitationdialog.C
1 /*
2  * formcitationdialog.C
3  * (C) 2000 LyX Team
4  * John Levon, moz@compsoc.man.ac.uk
5  */
6
7 /***************************************************************************
8  *                                                                         *
9  *   This program is free software; you can redistribute it and/or modify  *
10  *   it under the terms of the GNU General Public License as published by  *
11  *   the Free Software Foundation; either version 2 of the License, or     *
12  *   (at your option) any later version.                                   *
13  *                                                                         *
14  ***************************************************************************/
15
16 #include "formcitationdialog.h"
17
18 FormCitationDialog::FormCitationDialog(FormCitation *form, QWidget *parent, const char *name, bool, WFlags)
19         : QDialog(parent,name,false), form_(form)
20 {
21         setCaption(name);
22         setMinimumWidth(500);
23
24         // widgets
25
26         labelchosen = new QLabel(this);
27         labelchosen->setText(_("Selected keys"));
28         labelchosen->setMinimumSize(labelchosen->sizeHint());
29         labelchosen->setMaximumSize(labelchosen->sizeHint());
30
31         chosen = new QListBox(this);
32
33         labelkeys = new QLabel(this);
34         labelkeys->setText(_("Available keys"));
35         labelkeys->setMinimumSize(labelkeys->sizeHint());
36         labelkeys->setMaximumSize(labelkeys->sizeHint());
37
38         keys = new QListBox(this);
39
40         labelentry = new QLabel(this);
41         labelentry->setText(_("Reference entry"));
42         labelentry->setMinimumSize(labelentry->sizeHint());
43         labelentry->setMaximumSize(labelentry->sizeHint());
44
45         after = new QLineEdit(this);
46         after->setMinimumSize(after->sizeHint());
47
48         entry = new QMultiLineEdit(this);
49         entry->setReadOnly(true);
50         entry->setFixedVisibleLines(2); 
51
52         labelafter = new QLabel(this);
53         labelafter->setText(_("Text after"));
54         labelafter->setMargin(5);
55         labelafter->setMinimumSize(labelafter->sizeHint());
56         labelafter->setMaximumSize(labelafter->sizeHint());
57
58         /* FIXME: icons */
59         add = new QPushButton(this); 
60         add->setText(_("&Add"));
61         add->setMinimumSize(add->sizeHint());
62         add->setMaximumSize(add->sizeHint());
63  
64         up = new QPushButton(this); 
65         up->setText(_("&Up"));
66         up->setMinimumSize(up->sizeHint());
67         up->setMaximumSize(up->sizeHint());
68  
69         down = new QPushButton(this); 
70         down->setText(_("&Down"));
71         down->setMinimumSize(down->sizeHint());
72         down->setMaximumSize(down->sizeHint());
73  
74         remove = new QPushButton(this); 
75         remove->setText(_("&Remove"));
76         remove->setMinimumSize(remove->sizeHint());
77         remove->setMaximumSize(remove->sizeHint());
78
79         buttonOk = new QPushButton(this);
80         buttonOk->setText(_("&OK"));
81         buttonOk->setDefault(true);
82         buttonOk->setMinimumSize(buttonOk->sizeHint());
83         buttonOk->setMaximumSize(buttonOk->sizeHint());
84
85         buttonCancel = new QPushButton(this);
86         buttonCancel->setText(_("&Cancel"));
87         buttonCancel->setMinimumSize(buttonCancel->sizeHint());
88         buttonCancel->setMaximumSize(buttonCancel->sizeHint());
89
90         // tooltips
91
92         QToolTip::add(chosen,_("Keys currently selected"));
93         QToolTip::add(keys,_("Reference keys available"));
94         QToolTip::add(entry,_("Reference entry text"));
95         QToolTip::add(after,_("Text to place after citation"));
96
97         // layouts
98
99         topLayout = new QHBoxLayout(this,10);
100
101         layout = new QVBoxLayout();
102         topLayout->addLayout(layout);
103         layout->addSpacing(10);
104
105         browserLayout = new QHBoxLayout();
106         layout->addLayout(browserLayout,1);
107
108         chosenLayout = new QVBoxLayout();
109         browserLayout->addLayout(chosenLayout,1); 
110         iconLayout = new QVBoxLayout();
111         browserLayout->addLayout(iconLayout,0);
112         keysLayout = new QVBoxLayout();
113         browserLayout->addLayout(keysLayout,1);
114  
115         chosenLayout->addWidget(labelchosen, 0, AlignLeft);
116         chosenLayout->addWidget(chosen, 1);
117  
118         iconLayout->addStretch(1);
119         iconLayout->addWidget(add,1);
120         iconLayout->addStretch(1);
121         iconLayout->addWidget(up,1);
122         iconLayout->addStretch(1);
123         iconLayout->addWidget(down,1);
124         iconLayout->addStretch(1);
125         iconLayout->addWidget(remove,1);
126         iconLayout->addStretch(1);
127  
128         keysLayout->addWidget(labelkeys, 0, AlignLeft);
129         keysLayout->addWidget(keys, 1);
130
131         entryLayout = new QVBoxLayout();
132         layout->addLayout(entryLayout);
133  
134         entryLayout->addWidget(labelentry, 0, AlignLeft);
135         entryLayout->addWidget(entry, 0);
136
137         afterLayout = new QHBoxLayout();
138         layout->addLayout(afterLayout);
139
140         afterLayout->addWidget(labelafter, 0, AlignLeft);
141         afterLayout->addWidget(after, 1);
142  
143         buttonLayout = new QHBoxLayout();
144         layout->addLayout(buttonLayout);
145  
146         buttonLayout->addStretch(1);
147         buttonLayout->addWidget(buttonOk, 1);
148         buttonLayout->addStretch(2);
149         buttonLayout->addWidget(buttonCancel, 1);
150         buttonLayout->addStretch(1);
151  
152         // connections
153
154         connect(keys, SIGNAL(selected(const char *)), this, SLOT(select_key_adaptor(const char *)));
155         connect(keys, SIGNAL(highlighted(const char *)), this, SLOT(highlight_key_adaptor(const char *)));
156         connect(chosen, SIGNAL(highlighted(const char *)), this, SLOT(highlight_chosen_adaptor(const char *)));
157         connect(add, SIGNAL(clicked()), this, SLOT(add_adaptor()));
158         connect(up, SIGNAL(clicked()), this, SLOT(up_adaptor()));
159         connect(down, SIGNAL(clicked()), this, SLOT(down_adaptor()));   
160         connect(remove, SIGNAL(clicked()), this, SLOT(remove_adaptor()));
161         connect(buttonOk, SIGNAL(clicked()), this, SLOT(apply_adaptor()));
162         connect(buttonCancel, SIGNAL(clicked()), this, SLOT(close_adaptor()));
163 }
164
165 void FormCitationDialog::closeEvent(QCloseEvent *e)
166 {
167         form_->close();
168         e->accept();
169 }
170
171 FormCitationDialog::~FormCitationDialog()
172 {
173 }