3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Abdelrazak Younes
8 * Full author contact details are available in file CREDITS.
15 #include "qt_helpers.h"
18 #include "buffer_funcs.h"
19 #include "BufferParams.h"
20 #include "BufferView.h"
22 #include "FuncRequest.h"
24 #include "insets/InsetInfo.h"
26 #include "support/debug.h"
27 #include "support/lstrings.h"
31 using namespace lyx::support;
36 /////////////////////////////////////////////////////////////////
40 /////////////////////////////////////////////////////////////////
42 char const * info_types[] =
43 { "unknown", "shortcut", "shortcuts", "lyxrc", "package", "textclass", "menu", "icon", "buffer", "" };
45 char const * info_types_gui[] =
46 { N_("unknown"), N_("shortcut"), N_("shortcuts"), N_("lyxrc"), N_("package"), N_("textclass"),
47 N_("menu"), N_("icon"), N_("buffer"), ""};
51 GuiInfo::GuiInfo(GuiView & lv)
52 : DialogView(lv, "info", qt_("Info"))
56 connect(okPB, SIGNAL(clicked()), this, SLOT(slotApply()));
58 connect(typeCO, SIGNAL(clicked()), this, SLOT(change_adaptor()));
59 connect(nameLE, SIGNAL(textChanged(QString)), this, SLOT(change_adaptor()));
61 for (int n = 0; info_types[n][0]; ++n)
62 typeCO->addItem(qt_(info_types_gui[n]));
66 void GuiInfo::on_cancelPB_clicked()
72 void GuiInfo::applyView()
74 InsetInfo * ii = static_cast<InsetInfo *>(inset(INFO_CODE));
78 // FIXME: update the inset contents
80 updateLabels(bufferview()->buffer());
81 bufferview()->updateMetrics();
82 bufferview()->buffer().changed();
88 void GuiInfo::updateView()
90 InsetInfo * ii = static_cast<InsetInfo *>(inset(INFO_CODE));
92 typeCO->setCurrentIndex(0);
94 // FIXME: A New button to create an InsetInfo at the cursor location
100 int type = findToken(info_types, ii->infoType());
101 typeCO->setCurrentIndex(type >= 0 ? type : 0);
102 nameLE->setText(toqstr(ii->infoName()));
106 void GuiInfo::enableView(bool enable)
108 //FIXME: enable controls that need enabling.
112 void GuiInfo::dispatchParams()
117 Dialog * createGuiInfo(GuiView & lv) { return new GuiInfo(lv); }
120 } // namespace frontend
123 #include "GuiInfo_moc.cpp"