From 1c155241d88fa2106565711ef94396be42b912a9 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Wed, 30 Jul 2003 21:47:18 +0000 Subject: [PATCH] Martin's changes to the Note inset. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7456 a592a061-630c-0410-9148-cb99ea01b6c8 --- po/POTFILES.in | 1 + src/ChangeLog | 3 +++ src/LColor.C | 4 +++ src/LColor.h | 8 ++++++ src/frontends/controllers/ChangeLog | 4 +++ src/frontends/controllers/ControlNote.C | 17 +++++++++++++ src/frontends/controllers/ControlNote.h | 4 +++ src/frontends/xforms/ChangeLog | 5 ++++ src/frontends/xforms/FormNote.C | 33 ++++++++++++++++--------- src/frontends/xforms/FormNote.h | 4 ++- src/insets/ChangeLog | 5 ++++ src/insets/insetnote.C | 15 +++++++---- 12 files changed, 86 insertions(+), 17 deletions(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index 87864eb78a..ef8ddaab7f 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -21,6 +21,7 @@ src/frontends/controllers/ControlDocument.C src/frontends/controllers/ControlExternal.C src/frontends/controllers/ControlGraphics.C src/frontends/controllers/ControlInclude.C +src/frontends/controllers/ControlNote.C src/frontends/controllers/ControlPreamble.C src/frontends/controllers/ControlPrefs.C src/frontends/controllers/ControlPrint.C diff --git a/src/ChangeLog b/src/ChangeLog index ff1b01b7b4..82ed28ad5f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,6 @@ +2003-07-30 Martin Vermeer + + * LColor.[Ch]: Add comment and greyedout logical colors. 2003-07-30 André Pönitz diff --git a/src/LColor.C b/src/LColor.C index 836f7744c6..0ea92a1e12 100644 --- a/src/LColor.C +++ b/src/LColor.C @@ -87,6 +87,10 @@ LColor::LColor() { preview, N_("previewed snippet"), "preview", "black", "preview" }, { note, N_("note"), "note", "yellow", "note" }, { notebg, N_("note background"), "notebg", "yellow", "notebg" }, + { comment, N_("comment"), "comment", "magenta", "comment" }, + { commentbg, N_("comment background"), "commentbg", "linen", "commentbg" }, + { greyedout, N_("greyedout inset"), "greyedout", "red", "greyedout" }, + { greyedoutbg, N_("greyedout inset background"), "greyedoutbg", "linen", "greyedoutbg" }, { depthbar, N_("depth bar"), "depthbar", "IndianRed", "depthbar" }, { language, N_("language"), "language", "Blue", "language" }, { command, N_("command inset"), "command", "black", "command" }, diff --git a/src/LColor.h b/src/LColor.h index 43405264c9..8b7f669e1e 100644 --- a/src/LColor.h +++ b/src/LColor.h @@ -78,6 +78,14 @@ public: note, /// Background color of notes notebg, + /// Text color for comments + comment, + /// Background color of comments + commentbg, + /// Text color for greyedout inset + greyedout, + /// Background color of greyedout inset + greyedoutbg, /// Color for the depth bars in the margin diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 588a6c0924..b8a2db993d 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,7 @@ +2003-07-30 Martin Vermeer + + * ControlNote.[Ch]: add i18n support. + 2003-07-27 Lars Gullik Bjønnes * ControlToc.C (goTo): adjust for lyx::toc diff --git a/src/frontends/controllers/ControlNote.C b/src/frontends/controllers/ControlNote.C index 4a50523e39..99f6b4424c 100644 --- a/src/frontends/controllers/ControlNote.C +++ b/src/frontends/controllers/ControlNote.C @@ -14,6 +14,11 @@ #include "funcrequest.h" #include "insets/insetnote.h" #include "debug.h" +#include "gettext.h" + + +using std::vector; + ControlNote::ControlNote(Dialog & parent) : Dialog::Controller(parent) @@ -36,9 +41,21 @@ void ControlNote::clearParams() params_.reset(); } + void ControlNote::dispatchParams() { string const lfun = InsetNoteMailer::params2string(string("note"), params()); kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun)); } + +void note_gui_tokens(vector & ids, vector & gui_names) +{ + char const * const ids_[] = {"Note", "Comment", "Greyedout"}; + size_t const ids_size = sizeof(ids_) / sizeof(char *); + ids = vector(ids_, ids_ + ids_size); + gui_names.clear(); + gui_names.push_back(_("LyX Note")); + gui_names.push_back(_("Comment")); + gui_names.push_back(_("Greyed Out")); +} diff --git a/src/frontends/controllers/ControlNote.h b/src/frontends/controllers/ControlNote.h index 8bde9717ad..5cbc8ab69b 100644 --- a/src/frontends/controllers/ControlNote.h +++ b/src/frontends/controllers/ControlNote.h @@ -15,6 +15,7 @@ #include "Dialog.h" #include "debug.h" +#include class InsetNoteParams; @@ -40,4 +41,7 @@ private: boost::scoped_ptr params_; }; +/// +void note_gui_tokens(std::vector &, std::vector &); + #endif // CONTROLNOTE_H diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 4f2f6881e4..40636a981c 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,8 @@ +2003-07-30 Martin Vermeer + + (with help from Juergen Spitzmueller) + * FormNote.[Ch]: add i18n support to the dialog. + 2003-07-27 Lars Gullik Bjønnes * FormToc.C (updateType): adjust for lyx::toc diff --git a/src/frontends/xforms/FormNote.C b/src/frontends/xforms/FormNote.C index 6fa17eceee..40bbc96f1f 100644 --- a/src/frontends/xforms/FormNote.C +++ b/src/frontends/xforms/FormNote.C @@ -20,6 +20,11 @@ #include "insets/insetnote.h" #include "debug.h" +#include + +using std::vector; + + typedef FormController > base_class; FormNote::FormNote(Dialog & parent) @@ -27,20 +32,22 @@ FormNote::FormNote(Dialog & parent) {} -string const FormNote::predefineds() const -{ - return _("Note|Comment|Greyedout"); -} - - void FormNote::build() { dialog_.reset(build_note(this)); - fl_addto_choice(dialog_->choice_type, predefineds().c_str()); - string str = _("Note: LyX internal only\n" + note_gui_tokens(ids_, gui_names_); + + for (int i = 0; i < 3; ++i) { + } + + for (int i = 0; i < 3; ++i) { + fl_addto_choice(dialog_->choice_type, gui_names_[i].c_str()); + } + + string str = _("Lyx Note: LyX internal only\n" "Comment: Export to LaTeX but don't print\n" - "Greyedout: Print as grey text"); + "Greyed Out: Print as grey text"); tooltips().init(dialog_->choice_type, str); bcview().setOK(dialog_->button_ok); @@ -52,12 +59,16 @@ void FormNote::build() void FormNote::update() { string type(controller().params().type); - fl_set_choice_text(dialog_->choice_type, type.c_str()); + for (int i = 0; i < 3; ++i) { + if (type == ids_[i]) + fl_set_choice_text(dialog_->choice_type, gui_names_[i].c_str()); + } } void FormNote::apply() { - controller().params().type = fl_get_choice_text(dialog_->choice_type); + int i = fl_get_choice(dialog_->choice_type); + controller().params().type = ids_[i - 1]; } diff --git a/src/frontends/xforms/FormNote.h b/src/frontends/xforms/FormNote.h index 406105dc09..c65fbf648b 100644 --- a/src/frontends/xforms/FormNote.h +++ b/src/frontends/xforms/FormNote.h @@ -33,7 +33,9 @@ private: /// Update dialog before showing it virtual void update(); /// - string const predefineds() const; + std::vector ids_; + /// + std::vector gui_names_; }; #endif // FORMNOTE_H diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 8c31b752dc..edb40a0f66 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ +2003-07-30 Martin Vermeer + + (with help from Juergen Spitzmueller) + * insetnote.C: add add i18n support. Use Prefs-definable + colours for Comment and Greyedout. 2003-07-30 André Pönitz diff --git a/src/insets/insetnote.C b/src/insets/insetnote.C index 92a79b09f7..ec347dc355 100644 --- a/src/insets/insetnote.C +++ b/src/insets/insetnote.C @@ -41,7 +41,7 @@ InsetNote::InsetNote(BufferParams const & bp, string const & label) { params_.type = label; init(); - setLabel(label); + setButtonLabel(); } @@ -91,13 +91,18 @@ void InsetNote::setButtonLabel() font.decSize(); font.decSize(); - setLabel(params_.type); - if (params_.type == "Note" || params_.type == "Comment") { + if (params_.type == "Note") { + setLabel(_("LyX Note")); font.setColor(LColor::note); setBackgroundColor(LColor::notebg); + } else if (params_.type == "Comment") { + setLabel(_("Comment")); + font.setColor(LColor::comment); + setBackgroundColor(LColor::commentbg); } else { - font.setColor(LColor::red); - setBackgroundColor(LColor::background); + setLabel(_("Greyed Out")); + font.setColor(LColor::greyedout); + setBackgroundColor(LColor::greyedoutbg); } setLabelFont(font); } -- 2.39.2