]> git.lyx.org Git - lyx.git/blob - src/frontends/kde/citationdlg.C
Move LaTeX and VC logs to GUI-I on xforms
[lyx.git] / src / frontends / kde / citationdlg.C
1 /*
2  * citationdlg.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 <config.h>
17
18 #include "dlg/helpers.h"
19 #include "citationdlg.h"
20
21 #ifdef CXX_WORKING_NAMESPACES
22 using kde_helpers::setSizeHint;
23 #endif
24
25 CitationDialog::CitationDialog(FormCitation *form, QWidget *parent, const char *name, bool, WFlags)
26         : QWidget(parent,name,0), form_(form)
27 {
28         setCaption(name);
29         setMinimumWidth(500);
30
31         // widgets
32
33         labelchosen = new QLabel(this);
34         labelchosen->setText(_("Selected keys"));
35         setSizeHint(labelchosen);
36         labelchosen->setMaximumSize(labelchosen->sizeHint());
37
38         chosen = new QListBox(this);
39
40         labelkeys = new QLabel(this);
41         labelkeys->setText(_("Available keys"));
42         setSizeHint(labelkeys);
43         labelkeys->setMaximumSize(labelkeys->sizeHint());
44
45         keys = new QListBox(this);
46
47         labelentry = new QLabel(this);
48         labelentry->setText(_("Reference entry"));
49         setSizeHint(labelentry);
50         labelentry->setMaximumSize(labelentry->sizeHint());
51
52         after = new QLineEdit(this);
53         setSizeHint(after);
54
55         entry = new QMultiLineEdit(this);
56         entry->setReadOnly(true);
57         entry->setFixedVisibleLines(2); 
58
59         labelafter = new QLabel(this);
60         labelafter->setText(_("Text after"));
61         labelafter->setMargin(5);
62         setSizeHint(labelafter);
63         labelafter->setMaximumSize(labelafter->sizeHint());
64
65         /* FIXME: icons */
66         add = new QPushButton(this); 
67         add->setText(_("&Add"));
68         setSizeHint(add); 
69         add->setMaximumSize(add->sizeHint());
70  
71         up = new QPushButton(this); 
72         up->setText(_("&Up"));
73         setSizeHint(up); 
74         up->setMaximumSize(up->sizeHint());
75  
76         down = new QPushButton(this); 
77         down->setText(_("&Down"));
78         setSizeHint(down); 
79         down->setMaximumSize(down->sizeHint());
80  
81         remove = new QPushButton(this); 
82         remove->setText(_("&Remove"));
83         setSizeHint(remove); 
84         remove->setMaximumSize(remove->sizeHint());
85
86         buttonOk = new QPushButton(this);
87         buttonOk->setText(_("&OK"));
88         buttonOk->setDefault(true);
89         setSizeHint(buttonOk); 
90         buttonOk->setMaximumSize(buttonOk->sizeHint());
91
92         buttonCancel = new QPushButton(this);
93         buttonCancel->setText(_("&Cancel"));
94         setSizeHint(buttonCancel); 
95         buttonCancel->setMaximumSize(buttonCancel->sizeHint());
96
97         // tooltips
98
99         QToolTip::add(chosen,_("Keys currently selected"));
100         QToolTip::add(keys,_("Reference keys available"));
101         QToolTip::add(entry,_("Reference entry text"));
102         QToolTip::add(after,_("Text to place after citation"));
103
104         // layouts
105
106         topLayout = new QHBoxLayout(this,10);
107
108         layout = new QVBoxLayout();
109         topLayout->addLayout(layout);
110         layout->addSpacing(10);
111
112         browserLayout = new QHBoxLayout();
113         layout->addLayout(browserLayout,1);
114
115         chosenLayout = new QVBoxLayout();
116         browserLayout->addLayout(chosenLayout,1); 
117         iconLayout = new QVBoxLayout();
118         browserLayout->addLayout(iconLayout,0);
119         keysLayout = new QVBoxLayout();
120         browserLayout->addLayout(keysLayout,1);
121  
122         chosenLayout->addWidget(labelchosen, 0, AlignLeft);
123         chosenLayout->addWidget(chosen, 1);
124  
125         iconLayout->addStretch(1);
126         iconLayout->addWidget(add,1);
127         iconLayout->addStretch(1);
128         iconLayout->addWidget(up,1);
129         iconLayout->addStretch(1);
130         iconLayout->addWidget(down,1);
131         iconLayout->addStretch(1);
132         iconLayout->addWidget(remove,1);
133         iconLayout->addStretch(1);
134  
135         keysLayout->addWidget(labelkeys, 0, AlignLeft);
136         keysLayout->addWidget(keys, 1);
137
138         entryLayout = new QVBoxLayout();
139         layout->addLayout(entryLayout);
140  
141         entryLayout->addWidget(labelentry, 0, AlignLeft);
142         entryLayout->addWidget(entry, 0);
143
144         afterLayout = new QHBoxLayout();
145         layout->addLayout(afterLayout);
146
147         afterLayout->addWidget(labelafter, 0, AlignLeft);
148         afterLayout->addWidget(after, 1);
149  
150         buttonLayout = new QHBoxLayout();
151         layout->addLayout(buttonLayout);
152  
153         buttonLayout->addStretch(1);
154         buttonLayout->addWidget(buttonOk, 1);
155         buttonLayout->addStretch(2);
156         buttonLayout->addWidget(buttonCancel, 1);
157         buttonLayout->addStretch(1);
158  
159         // connections
160
161         connect(keys, SIGNAL(selected(const char *)), this, SLOT(select_key_adaptor(const char *)));
162         connect(keys, SIGNAL(highlighted(const char *)), this, SLOT(highlight_key_adaptor(const char *)));
163         connect(chosen, SIGNAL(highlighted(const char *)), this, SLOT(highlight_chosen_adaptor(const char *)));
164         connect(add, SIGNAL(clicked()), this, SLOT(add_adaptor()));
165         connect(up, SIGNAL(clicked()), this, SLOT(up_adaptor()));
166         connect(down, SIGNAL(clicked()), this, SLOT(down_adaptor()));   
167         connect(remove, SIGNAL(clicked()), this, SLOT(remove_adaptor()));
168         connect(buttonOk, SIGNAL(clicked()), this, SLOT(apply_adaptor()));
169         connect(buttonCancel, SIGNAL(clicked()), this, SLOT(close_adaptor()));
170         
171         resize(sizeHint());
172 }
173
174 CitationDialog::~CitationDialog()
175 {
176 }
177
178 void CitationDialog::closeEvent(QCloseEvent *e)
179 {
180         form_->close();
181         e->accept();
182 }