314 |
StringEntry::StringEntry(const char* labelText) : |
StringEntry::StringEntry(const char* labelText) : |
315 |
LabelWidget(labelText, entry) |
LabelWidget(labelText, entry) |
316 |
{ |
{ |
317 |
entry.signal_changed().connect( |
entry.signal_changed().connect(sig_changed.make_slot()); |
|
sigc::mem_fun(*this, &StringEntry::value_changed)); |
|
318 |
} |
} |
319 |
|
|
320 |
void StringEntry::value_changed() |
StringEntryMultiLine::StringEntryMultiLine(const char* labelText) : |
321 |
|
LabelWidget(labelText, frame) |
322 |
{ |
{ |
323 |
if (ptr) { |
text_buffer = text_view.get_buffer(); |
324 |
*ptr = entry.get_text(); |
frame.set_shadow_type(Gtk::SHADOW_IN); |
325 |
sig_changed(); |
frame.add(text_view); |
326 |
} |
text_buffer->signal_changed().connect(sig_changed.make_slot()); |
327 |
} |
} |
328 |
|
|
329 |
void StringEntry::set_ptr(gig::String* ptr) |
gig::String StringEntryMultiLine::get_value() const |
330 |
{ |
{ |
331 |
this->ptr = 0; |
Glib::ustring value = text_buffer->get_text(); |
332 |
entry.set_text(*ptr); |
for (int i = 0 ; (i = value.find("\x0a", i)) >= 0 ; i += 2) |
333 |
this->ptr = ptr; |
value.replace(i, 1, "\x0d\x0a"); |
334 |
|
return value; |
335 |
|
} |
336 |
|
|
337 |
|
void StringEntryMultiLine::set_value(gig::String value) |
338 |
|
{ |
339 |
|
for (int i = 0 ; (i = value.find("\x0d\x0a", i, 2)) >= 0 ; i++) |
340 |
|
value.replace(i, 2, "\x0a"); |
341 |
|
text_buffer->set_text(value); |
342 |
} |
} |