On Wed, Jul 30, 2003 at 03:56:36PM +0200, Juergen Spitzmueller spake thusly:
> 
> Martin Vermeer wrote:
> > Better this way?
> 
> I'll keep you busy ;-)

OK!

- internationalization support to insetnote and its dialog,
using Angus' approach and Jürgen's patch
- definable colours for Comment and Greyedout, Jürgen's other patch.

See attached.

Can this be committed?

Martin

-- 
Martin Vermeer  [EMAIL PROTECTED]
Helsinki University of Technology 
Dept. of Surveying, Inst. of Geodesy
P.O. Box 1200, FIN-02015 HUT, Finland
:wq
Index: insets/insetnote.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetnote.C,v
retrieving revision 1.36
diff -u -p -r1.36 insetnote.C
--- insets/insetnote.C  30 Jul 2003 14:43:14 -0000      1.36
+++ insets/insetnote.C  30 Jul 2003 18:46:35 -0000
@@ -41,7 +41,7 @@ InsetNote::InsetNote(BufferParams const 
 {
        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);
 }
Index: frontends/xforms/FormNote.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormNote.C,v
retrieving revision 1.3
diff -u -p -r1.3 FormNote.C
--- frontends/xforms/FormNote.C 18 Jul 2003 14:51:13 -0000      1.3
+++ frontends/xforms/FormNote.C 30 Jul 2003 18:46:35 -0000
@@ -20,6 +20,8 @@
 #include "insets/insetnote.h"
 #include "debug.h"
 
+#include <vector>
+
 typedef FormController<ControlNote, FormView<FD_note> > base_class;
 
 FormNote::FormNote(Dialog & parent)
@@ -27,20 +29,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 +56,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];
 }
 
Index: frontends/xforms/FormNote.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormNote.h,v
retrieving revision 1.3
diff -u -p -r1.3 FormNote.h
--- frontends/xforms/FormNote.h 18 Jul 2003 14:51:13 -0000      1.3
+++ frontends/xforms/FormNote.h 30 Jul 2003 18:46:35 -0000
@@ -33,7 +33,9 @@ private:
        /// Update dialog before showing it
        virtual void update();
        ///
-       string const predefineds() const;
+       vector<string> ids_;
+       ///
+       vector<string> gui_names_;
 };
 
 #endif // FORMNOTE_H
Index: frontends/controllers/ControlNote.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlNote.C,v
retrieving revision 1.1
diff -u -p -r1.1 ControlNote.C
--- frontends/controllers/ControlNote.C 8 Jul 2003 14:19:24 -0000       1.1
+++ frontends/controllers/ControlNote.C 30 Jul 2003 18:46:35 -0000
@@ -14,6 +14,7 @@
 #include "funcrequest.h"
 #include "insets/insetnote.h"
 #include "debug.h"
+#include "gettext.h"
 
 ControlNote::ControlNote(Dialog & parent)
        : Dialog::Controller(parent)
@@ -42,3 +43,13 @@ void ControlNote::dispatchParams()
        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"));
+}
Index: frontends/controllers/ControlNote.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlNote.h,v
retrieving revision 1.1
diff -u -p -r1.1 ControlNote.h
--- frontends/controllers/ControlNote.h 8 Jul 2003 14:19:24 -0000       1.1
+++ frontends/controllers/ControlNote.h 30 Jul 2003 18:46:35 -0000
@@ -15,6 +15,7 @@
 
 #include "Dialog.h"
 #include "debug.h"
+#include <vector>
 
 class InsetNoteParams;
 
@@ -39,5 +40,8 @@ private:
        ///
        boost::scoped_ptr<InsetNoteParams> params_;
 };
+
+       ///
+       void note_gui_tokens(vector<string> &, vector<string> &);
 
 #endif // CONTROLNOTE_H
Index: LColor.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/LColor.C,v
retrieving revision 1.42
diff -u -p -r1.42 LColor.C
--- LColor.C    30 Jun 2003 23:55:49 -0000      1.42
+++ LColor.C    30 Jul 2003 18:46:35 -0000
@@ -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" },
Index: LColor.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/LColor.h,v
retrieving revision 1.29
diff -u -p -r1.29 LColor.h
--- LColor.h    9 May 2003 09:43:38 -0000       1.29
+++ LColor.h    30 Jul 2003 18:46:35 -0000
@@ -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

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to