*
* \author Angus Leeming
*
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
*/
#include <config.h>
-
#include "FormDialogView.h"
-#include "Dialog.h"
-#include "xformsBC.h"
-#include "ButtonController.h"
-#include "xforms_resize.h"
#include "Tooltips.h"
#include "xforms_helpers.h" // formatted
+#include "xforms_resize.h"
+#include "xformsBC.h"
+
+#include "controllers/ButtonController.h"
-#include "gettext.h" // _()
#include "lyxrc.h"
-#include "support/BoostFormat.h"
-#include "support/LAssert.h"
#include "support/filetools.h" // LibFileSearch
+#include "support/lstrings.h"
+
+#include "lyx_forms.h"
+
+using lyx::support::bformat;
+using lyx::support::LibFileSearch;
+
+using std::string;
-#include FORMS_H_LOCATION
extern "C" {
FormDialogView::FormDialogView(Dialog & parent,
string const & t, bool allowResize)
- : Dialog::View(parent),
+ : Dialog::View(parent, t),
warning_posted_(false), message_widget_(0),
minw_(0), minh_(0), allow_resize_(allowResize),
- title_(t), icon_pixmap_(0), icon_mask_(0),
- tooltips_(new Tooltips())
+ icon_pixmap_(0), icon_mask_(0),
+ tooltips_(new Tooltips)
{}
// set the title for the minimized form
if (!lyxrc.dialogs_iconify_with_main)
- fl_winicontitle(form()->window, title_.c_str());
+ fl_winicontitle(form()->window, getTitle().c_str());
// assign an icon to the form
string const iconname = LibFileSearch("images", "lyx", "xpm");
if (!allow_resize_)
fl_set_form_maxsize(form(), minw_, minh_);
- string const maximize_title = "LyX: " + title_;
+ string const maximize_title = "LyX: " + getTitle();
int const iconify_policy = lyxrc.dialogs_iconify_with_main ?
FL_TRANSIENT : 0;
void FormDialogView::setPrehandler(FL_OBJECT * ob)
{
- lyx::Assert(ob);
+ BOOST_ASSERT(ob);
fl_set_object_prehandler(ob, C_PrehandlerCB);
}
void FormDialogView::setMessageWidget(FL_OBJECT * ob)
{
- lyx::Assert(ob && ob->objclass == FL_TEXT);
+ BOOST_ASSERT(ob && ob->objclass == FL_TEXT);
message_widget_ = ob;
fl_set_object_lsize(message_widget_, FL_NORMAL_SIZE);
}
// preemptive handler for feedback messages
void FormDialogView::MessageCB(FL_OBJECT * ob, int event)
{
- lyx::Assert(ob);
+ BOOST_ASSERT(ob);
switch (event) {
case FL_ENTER:
void FormDialogView::PrehandlerCB(FL_OBJECT * ob, int event, int key)
{
- lyx::Assert(ob);
+ BOOST_ASSERT(ob);
if (ob->objclass == FL_INPUT && event == FL_PUSH && key == 2) {
// Trigger an input event when pasting in an xforms input
void FormDialogView::clearMessage()
{
- lyx::Assert(message_widget_);
+ BOOST_ASSERT(message_widget_);
warning_posted_ = false;
void FormDialogView::postMessage(string const & message)
{
- lyx::Assert(message_widget_);
+ BOOST_ASSERT(message_widget_);
int const width = message_widget_->w - 10;
-#if USE_BOOST_FORMAT
- boost::format fmter = warning_posted_ ?
- boost::format(_("WARNING! %1$s")) :
- boost::format("%1$s");
-
- string const str = formatted(boost::io::str(fmter % message),
- width, FL_NORMAL_SIZE);
-#else
string const tmp = warning_posted_ ?
- _("WARNING!") + string(" ") + message :
+ bformat(_("WARNING! %1$s"), message) :
message;
string const str = formatted(tmp, width, FL_NORMAL_SIZE);
-#endif
fl_set_object_label(message_widget_, str.c_str());
FL_COLOR const label_color = warning_posted_ ? FL_RED : FL_LCOL;
FormDialogView * GetForm(FL_OBJECT * ob)
{
- lyx::Assert(ob && ob->form && ob->form->u_vdata);
+ BOOST_ASSERT(ob && ob->form && ob->form->u_vdata);
FormDialogView * ptr =
static_cast<FormDialogView *>(ob->form->u_vdata);
return ptr;
static int C_WMHideCB(FL_FORM * form, void *)
{
// Close the dialog cleanly, even if the WM is used to do so.
- lyx::Assert(form && form->u_vdata);
+ BOOST_ASSERT(form && form->u_vdata);
FormDialogView * ptr = static_cast<FormDialogView *>(form->u_vdata);
ptr->dialog().CancelButton();
return FL_CANCEL;
{
// Note that the return value is important in the pre-emptive handler.
// Don't return anything other than 0.
- lyx::Assert(ob);
+ BOOST_ASSERT(ob);
// Don't Assert this one, as it can happen quite naturally when things
// are being deleted in the d-tor.
- //Assert(ob->form);
+ //BOOST_ASSERT(ob->form);
if (!ob->form) return 0;
FormDialogView * ptr =