17 |
* 02110-1301 USA. |
* 02110-1301 USA. |
18 |
*/ |
*/ |
19 |
|
|
20 |
|
#include <cstring> |
21 |
|
|
22 |
#include "paramedit.h" |
#include "paramedit.h" |
23 |
|
|
24 |
namespace { |
namespace { |
316 |
StringEntry::StringEntry(const char* labelText) : |
StringEntry::StringEntry(const char* labelText) : |
317 |
LabelWidget(labelText, entry) |
LabelWidget(labelText, entry) |
318 |
{ |
{ |
319 |
entry.signal_changed().connect( |
entry.signal_changed().connect(sig_changed.make_slot()); |
|
sigc::mem_fun(*this, &StringEntry::value_changed)); |
|
320 |
} |
} |
321 |
|
|
322 |
void StringEntry::value_changed() |
StringEntryMultiLine::StringEntryMultiLine(const char* labelText) : |
323 |
|
LabelWidget(labelText, frame) |
324 |
{ |
{ |
325 |
if (ptr) { |
text_buffer = text_view.get_buffer(); |
326 |
*ptr = entry.get_text(); |
frame.set_shadow_type(Gtk::SHADOW_IN); |
327 |
sig_changed(); |
frame.add(text_view); |
328 |
} |
text_buffer->signal_changed().connect(sig_changed.make_slot()); |
329 |
|
} |
330 |
|
|
331 |
|
gig::String StringEntryMultiLine::get_value() const |
332 |
|
{ |
333 |
|
Glib::ustring value = text_buffer->get_text(); |
334 |
|
for (int i = 0 ; (i = value.find("\x0a", i)) >= 0 ; i += 2) |
335 |
|
value.replace(i, 1, "\x0d\x0a"); |
336 |
|
return value; |
337 |
} |
} |
338 |
|
|
339 |
void StringEntry::set_ptr(gig::String* ptr) |
void StringEntryMultiLine::set_value(gig::String value) |
340 |
{ |
{ |
341 |
this->ptr = 0; |
for (int i = 0 ; (i = value.find("\x0d\x0a", i, 2)) >= 0 ; i++) |
342 |
entry.set_text(*ptr); |
value.replace(i, 2, "\x0a"); |
343 |
this->ptr = ptr; |
text_buffer->set_text(value); |
344 |
} |
} |