X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fxforms%2FFormCharacter.C;h=5689892814207113a1e17f148c25da88eaf7f834;hb=14c60d0aaeff364a78f77e163e6eae5fc3dab8c0;hp=be81b82b280c117e0834a1de5f76bdcb04565df1;hpb=f65b7ff4ab2fe8ad0d9196c231064240e3fde81f;p=lyx.git diff --git a/src/frontends/xforms/FormCharacter.C b/src/frontends/xforms/FormCharacter.C index be81b82b28..5689892814 100644 --- a/src/frontends/xforms/FormCharacter.C +++ b/src/frontends/xforms/FormCharacter.C @@ -8,12 +8,12 @@ #include +#include FORMS_H_LOCATION + #ifdef __GNUG_ #pragma implementation #endif -#include FORMS_H_LOCATION - #include "FormCharacter.h" #include "form_character.h" #include "bufferview_funcs.h" @@ -25,15 +25,11 @@ #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 @@ -44,32 +40,23 @@ FormCharacter::FormCharacter(LyXView * lv, Dialogs * d) } -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 ")); @@ -93,26 +80,24 @@ void FormCharacter::build() // 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); @@ -195,13 +180,13 @@ void FormCharacter::apply() 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); @@ -214,10 +199,8 @@ void FormCharacter::apply() void FormCharacter::update() { - if (!dialog_) + if (!dialog_.get()) return; - bc_.readOnly(lv_->buffer()->isReadonly()); + bc().readOnly(lv_->buffer()->isReadonly()); } - -