#include <config.h>
+#include FORMS_H_LOCATION
+
#ifdef __GNUG_
#pragma implementation
#endif
-#include FORMS_H_LOCATION
-
#include "FormCharacter.h"
#include "form_character.h"
#include "bufferview_funcs.h"
#include "language.h"
#include "combox.h"
-#ifdef CXX_WORKING_NAMESPACES
using Liason::setMinibuffer;
-#endif
-
+using SigC::slot;
FormCharacter::FormCharacter(LyXView * lv, Dialogs * d)
- : FormBaseBD(lv, d, _("Character Layout"),
- new NoRepeatedApplyReadOnlyPolicy),
- dialog_(0), combo_language2(0)
+ : FormBaseBD(lv, d, _("Character Layout"))
{
// let the popup be shown
// This is a permanent connection so we won't bother
}
-FormCharacter::~FormCharacter()
-{
- delete dialog_;
- delete combo_language2;
-
-}
-
-
FL_FORM * FormCharacter::form() const
{
- if (dialog_)
+ if (dialog_.get())
return dialog_->form;
return 0;
}
+
void FormCharacter::build()
{
- dialog_ = build_character();
- // Workaround dumb xforms sizing bug
- minw_ = form()->w;
- minh_ = form()->h;
+ dialog_.reset(build_character());
+
// Manage the ok, apply and cancel/close buttons
- bc_.setApply(dialog_->button_apply);
- bc_.setCancel(dialog_->button_close);
- bc_.refresh();
- bc_.addReadOnly (dialog_->check_toggle_all);
+ bc().setApply(dialog_->button_apply);
+ bc().setCancel(dialog_->button_close);
+ bc().refresh();
+ bc().addReadOnly (dialog_->check_toggle_all);
fl_addto_choice(dialog_->choice_family,
_(" No change %l| Roman | Sans Serif | Typewriter %l| Reset "));
// insert default language box manually
fl_addto_form(dialog_->form);
FL_OBJECT * ob = dialog_->choice_language;
- combo_language2 = new Combox(FL_COMBOX_DROPLIST);
- combo_language2->add(ob->x, ob->y, ob->w, ob->h, 250);
- combo_language2->shortcut("#L", 1);
+ combo_language2_.reset(new Combox(FL_COMBOX_DROPLIST));
+ combo_language2_->add(ob->x, ob->y, ob->w, ob->h, 250);
+ combo_language2_->shortcut("#L", 1);
fl_end_form();
// build up the combox entries
- combo_language2->addline(_("No change"));
- combo_language2->addline(_("Reset"));
+ combo_language2_->addline(_("No change"));
+ combo_language2_->addline(_("Reset"));
for (Languages::const_iterator cit = languages.begin();
cit != languages.end(); ++cit) {
- combo_language2->addto((*cit).second.lang());
+ combo_language2_->addto((*cit).second.lang());
}
-
-
}
void FormCharacter::apply()
{
- if (!lv_->view()->available() || !dialog_)
+ if (!lv_->view()->available() || !dialog_.get())
return;
LyXFont font(LyXFont::ALL_IGNORE);
case 11: font.setColor(LColor::inherit); break;
}
- int const choice = combo_language2->get();
+ int const choice = combo_language2_->get();
if (choice == 1)
font.setLanguage(ignore_language);
else if (choice == 2)
font.setLanguage(lv_->buffer()->params.language);
else
- font.setLanguage(languages.getLanguage(combo_language2->getline()));
+ font.setLanguage(languages.getLanguage(combo_language2_->getline()));
bool toggleall = fl_get_button(dialog_->check_toggle_all);
void FormCharacter::update()
{
- if (!dialog_)
+ if (!dialog_.get())
return;
- bc_.readOnly(lv_->buffer()->isReadonly());
+ bc().readOnly(lv_->buffer()->isReadonly());
}
-
-