On Wed, Jul 30, 2003 at 03:24:09PM +0000, Angus Leeming spake thusly:
> 
> Martin Vermeer wrote:
> 
> >> controller().params().type = fl_get_choice_text(dialog_->choice_type);
> >> will just break when
> >> _("Note|Comment|Greyedout");
> >> gets translated.
> > 
> > Ah! Yes, these are standard tokens and should not be translated. But
> > we need "user names" in locale to present in the menu. Hmmm...
> 
> Add a function to ControlNote.[Ch]
> 
> 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 *);
>         char const * const gui_names_[] =
>                 {_("Note"), _("comment"), _("greyedout") };
>         size_t const gui_names_size = sizeof(gui_names_) / sizeof(char *);
>         ids = vector<string>(ids_, ids_ + ids_size);
>         gui_names = vector<string>(gui_names_, gui_names_ + gui_names_size);
> }
> 
> Use gui_names to fill the gui widget and then discard.
> Store ids in FormNote, QtNote and use it to get/set the params.
> 
> Or something...
> 
> -- 
> Angus

I did this:


--- ControlNote.C
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 *);
    char const * const gui_names_[] =
        {_("Note").c_str(), _("comment").c_str(), _("greyedout").c_str() };
    size_t const gui_names_size = sizeof(gui_names_) / sizeof(char *);
    ids = vector<string>(ids_, ids_ + ids_size);
    gui_names = vector<string>(gui_names_, gui_names_ +
gui_names_size);
}
--- ControlNote.h
    ///
    void note_gui_tokens(vector<string> &, vector<string> &);

--- FormNote.C
void FormNote::build()
{
    dialog_.reset(build_note(this));

    ControlNote::note_gui_tokens(ids_, gui_names_);

    for (int i=1; i < 4; ++i) {
        fl_addto_choice(dialog_->choice_type, gui_names_[i].c_str());
    }

...etc...

--- FormNote.h/private
    ///
    vector<string> ids_;
    ///
    vector<string> gui_names_;

...and I get

FormNote.C: In method `void FormNote::build()':
FormNote.C:36: cannot call member function
`ControlNote::note_gui_tokens(vector<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0>
 
>,allocator<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0>
 >> > > &, >> > > 
vector<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> >> 
> > 
>,allocator<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0>
 >> > > >> > > &)' without object
make: *** [FormNote.o] Error 1

If I provide an object

    ControlNote cn;
    cn.note_gui_tokens(ids_, gui_names_);

...I get

FormNote.C: In method `void FormNote::build()':
FormNote.C:36: no matching function for call to `ControlNote::ControlNote ()'
../../../src/frontends/controllers/ControlNote.h:25: candidates are: 
ControlNote::ControlNote(Dialog &)
../../../src/frontends/controllers/ControlNote.h:44: ControlNote::ControlNote(const 
ControlNote &)
 
What's the problem? What constructor should I use?

Baffled as always,

Martin

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to