Martin's changes to the Note inset.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7456 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-07-30 21:47:18 +00:00
parent 202900df42
commit 1c155241d8
12 changed files with 86 additions and 17 deletions

View File

@ -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

View File

@ -1,3 +1,6 @@
2003-07-30 Martin Vermeer <martin.vermeer@hut.fi>
* LColor.[Ch]: Add comment and greyedout logical colors.
2003-07-30 André Pönitz <poenitz@gmx.net>

View File

@ -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" },

View File

@ -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

View File

@ -1,3 +1,7 @@
2003-07-30 Martin Vermeer <martin.vermeer@hut.fi>
* ControlNote.[Ch]: add i18n support.
2003-07-27 Lars Gullik Bjønnes <larsbj@gullik.net>
* ControlToc.C (goTo): adjust for lyx::toc

View File

@ -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<string> & ids, vector<string> & gui_names)
{
char const * const ids_[] = {"Note", "Comment", "Greyedout"};
size_t const ids_size = sizeof(ids_) / sizeof(char *);
ids = vector<string>(ids_, ids_ + ids_size);
gui_names.clear();
gui_names.push_back(_("LyX Note"));
gui_names.push_back(_("Comment"));
gui_names.push_back(_("Greyed Out"));
}

View File

@ -15,6 +15,7 @@
#include "Dialog.h"
#include "debug.h"
#include <vector>
class InsetNoteParams;
@ -40,4 +41,7 @@ private:
boost::scoped_ptr<InsetNoteParams> params_;
};
///
void note_gui_tokens(std::vector<string> &, std::vector<string> &);
#endif // CONTROLNOTE_H

View File

@ -1,3 +1,8 @@
2003-07-30 Martin Vermeer <martin.vermeer@hut.fi>
(with help from Juergen Spitzmueller)
* FormNote.[Ch]: add i18n support to the dialog.
2003-07-27 Lars Gullik Bjønnes <larsbj@gullik.net>
* FormToc.C (updateType): adjust for lyx::toc

View File

@ -20,6 +20,11 @@
#include "insets/insetnote.h"
#include "debug.h"
#include <vector>
using std::vector;
typedef FormController<ControlNote, FormView<FD_note> > 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];
}

View File

@ -33,7 +33,9 @@ private:
/// Update dialog before showing it
virtual void update();
///
string const predefineds() const;
std::vector<string> ids_;
///
std::vector<string> gui_names_;
};
#endif // FORMNOTE_H

View File

@ -1,3 +1,8 @@
2003-07-30 Martin Vermeer <martin.vermeer@hut.fi>
(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 <poenitz@gmx.net>

View File

@ -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);
}